Django Admin Error 'wsgirequest' Object Has No Attribute 'user
Solution 1:
Django 2.0 has dropped support for old-style middleware classes in MIDDLEWARE_CLASSES
changelog, 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"