python - Django : 'WSGIRequest' object has no attribute 'user'? - AuthenticationMiddleware & SessionAuthenticationMiddleware are in sequence -


getting following error while try access django admin panel.

environment:  request method: request url: http://localhost:8000/admin/  django version: 1.9.8 python version: 2.7.10 installed applications: ['django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles',  'bookapp'] installed middleware: ['django.middleware.common.commonmiddleware',  'django.middleware.csrf.csrfviewmiddleware']  traceback:  file "/library/python/2.7/site-packages/django/core/handlers/base.py"     in get_response   149.                     response =         self.process_exception_by_middleware(e, request)  file "/library/python/2.7/site-packages/django/core/handlers/base.py" in get_response   147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)  file "/library/python/2.7/site-packages/django/contrib/admin/sites.py" in wrapper   265.                 return self.admin_view(view, cacheable)(*args, **kwargs)  file "/library/python/2.7/site-packages/django/utils/decorators.py" in _wrapped_view   149.                     response = view_func(request, *args, **kwargs)  file "/library/python/2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func   57.         response = view_func(request, *args, **kwargs)  file "/library/python/2.7/site-packages/django/contrib/admin/sites.py" in inner   233.             if not self.has_permission(request):  file "/library/python/2.7/site-packages/django/contrib/admin/sites.py" in has_permission   173.         return request.user.is_active , request.user.is_staff  exception type: attributeerror @ /admin/ exception value: 'wsgirequest' object has no attribute 'user' 

here middleware settings in settings.py

middleware_classes = [ 'django.middleware.security.securitymiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', ] 

i have tried clearing cache cleared migrations , deleted database. won't work me.

can knows what's issue here?

change name middleware middleware_classes.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -