[Django]-Python 3.6 JsonResponse issue

3👍

The problem isn’t return JsonResponse({'status': '1'}).

The traceback is showing you that the error occurs when Django tries to save the Django session.

You must be doing something like this in the view:

request.session['my_key'] = b'bytes'

For that example, you would have to decode the bytes object (or use a string instead):

request.session['my_key'] = b'bytes'.decode('utf-8')

Leave a comment