AttributeError: ‘WSGIRequest’ object has no attribute ‘session’ Django python web framework

While working on Django I got this error message “AttributeError: ‘WSGIRequest’ object has no attribute ‘session'”

To solve this issue it is just 2 steps away. I hope you already know about how to start and stop the python based django.

Step 1: Edit the settings.py file.And add the following line. Replace the FQDN with your Server’s FQDN. for eg. django.example.com

 vi /path-of-project/project-name/project-name/settings.py

ALLOWED_HOSTS=['FQDN']

Step 2: Now stop and start the Django .Means kill python process which runs Django and start the process once again

Reference : https://django.readthedocs.io/en/1.5.x/ref/settings.html

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.