Skip to content Skip to sidebar Skip to footer

Django Admin Error 'wsgirequest' Object Has No Attribute 'user

I am practicing Django, and when i try to go to http://localhost/admin/ i get the below error, I have checked settings.py and MIDDLEWARE_CLASSES does exist, is there any other reas

Solution 1:

Django 2.0 has dropped support for old-style middleware classes in MIDDLEWARE_CLASSESchangelog, last item

Upgrading is straightforward if you use only standard middleware, explained in Upgrading pre-Django 1.10-style middleware. Often just renaming MIDDLEWARE_CLASSES to MIDDLEWARE and removing 'django.contrib.auth.middleware.SessionAuthenticationMiddleware' is enough.

You must also make sure django.contrib.auth is installed properly. In addition to SessionMiddleware, which you already have, you should add django.contrib.auth.middleware.AuthenticationMiddleware to the MIDDLEWARE setting.

Solution 2:

My original Django version was 1.9 . I ran into the same issue after upgrading to version 2.0.5. Renaming MIDDLEWARE_CLASSES to MIDDLEWARE and removing 'django.contrib.auth.middleware.SessionAuthenticationMiddleware' in settings.py did the job

Post a Comment for "Django Admin Error 'wsgirequest' Object Has No Attribute 'user"