1👍
✅
Try importing json, and on your return use json.dumps(response_details):
return Response(json.dumps(response_details), status=response_details['status'])
2👍
In older versions of PyJWT like 1.7 decode is required at the end:
jwt.encode(payload, "SECRET_KEY", algorithm='HS256').decode('utf-8')
If you are using the recent versions like 2.3.1 it is not necessary to dump or decode, a string will be generated already in UTF-8
- [Django]-Confused about adding apps to INSTALLED_APPS
- [Django]-Which software for intranet CMS – Django or Joomla?
- [Django]-Django psycopg2.errors.InvalidSchemaName: no schema has been selected to create in
- [Django]-Django admin: how do I filter a ForeignKeyField widget based on the object's (not request.user's) data?
- [Django]-Is it safe to query Django ORM directly with the user input?
Source:stackexchange.com