Hi python masters, im django api is giving me this error
HttpStreamingResponse to be returned from the view, but received a
my viewSet extends from viewsets.ModelViewSet, I thoug this would generate the general CRUD for me but returns this error.
queryset = models.Category.objects.all()
serializer_class = serializers.CategorySerializer
Hi, what is the best approach to handle access token and refreshing them for a django app.
I want to refresh the access token before it gets expired. I am trying to handle instagram refresh token
what I have understood is, save access_token and save the expiry date, run cron job once every few weeks, check if the token has expired or about to expire and refresh it via the refresh token and update the access_token.
please guid me through an approach if this does not sound very optimal to you guys. Thanks
Hello, I hope this is the right place to ask for this advice.
I need to allow rest api (DRF) consumers to access on a seperate browser tab (hence I cannot set headers) to connect to a django view, which will redirect them to a 3rd party service, and later be redirected back to the server. I also need to make this secure, and I cannot request login in the nee tab.
My current solution:
User access a specific api endpoint using token authentication (DRF based), which returns a temporary token. The token is used as a cache key in the server with a short expiry.
Browser opens a new window and sets the URL to the django view with the temp token. If the cache holds a non stale value for the key, the request session is updated with a permanent token (property added to session ).
This works and I added a few Kore security steps to this scheme, but my problem is that this is not very secure still. Also due to the ingress setup, I cannot record and track client IPS.
development? Static is working with collectstatic in prod but I had to reset my settings.py and I forgot what setting I needed for this to work
STATIC_URL = '/static/' STATICFILES_DIRS =  STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
@trevdev:matrix.org If you already use collecstatic, Django moves static files from
django/contrib/admin/static/admin to the directory indicated by the
STATIC_ROOT = os.path.join (BASE_DIR, 'static ') variable in your settings.py
In production these should be served by an apache or nginx web server.
To change again use Just set False the variable