'WSGIRequest' object has no attribute '

4,399 views
Skip to first unread message

sagar ninave

unread,
May 20, 2019, 5:57:05 AM5/20/19
to Django users
 AttributeError at /admin/  'WSGIRequest' object has no attribute 'user'  Request Method:     GET Request URL:     http://127.0.0.1:8000/admin/ Django Version:     2.2 Exception Type:     AttributeError Exception Value:       'WSGIRequest' object has no attribute '




i am getting this error please help me
i have attached zipfile of my project
microblog.zip

Abu Yusuf

unread,
May 20, 2019, 12:12:32 PM5/20/19
to django...@googlegroups.com
Where is your manage.py file? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eee17c55-c0ec-408d-bd54-10539e93cb9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sagar ninave

unread,
May 21, 2019, 10:56:06 AM5/21/19
to django...@googlegroups.com
my manage.py is in project folder you can check attachment


For more options, visit https://groups.google.com/d/optout.


--

Abu Yusuf

unread,
May 22, 2019, 4:37:27 AM5/22/19
to django...@googlegroups.com
This issue has been resolved yet? 

Abu Yusuf

unread,
May 22, 2019, 4:56:16 AM5/22/19
to django...@googlegroups.com

Comment out the

#'django.contrib.auth.middleware.SessionAuthenticationMiddleware',

in your settings.py file in Middleware or remove. Then run again. It will work.

sagar ninave

unread,
May 22, 2019, 5:43:30 AM5/22/19
to django...@googlegroups.com
no i am getting this error again



For more options, visit https://groups.google.com/d/optout.

Abu Yusuf

unread,
May 22, 2019, 5:49:35 AM5/22/19
to django...@googlegroups.com
I did run your project and it's working fine.

sagar ninave

unread,
May 22, 2019, 5:58:10 AM5/22/19
to django...@googlegroups.com
when i am opening admin panel then it is getting error


For more options, visit https://groups.google.com/d/optout.

Abu Yusuf

unread,
May 22, 2019, 6:01:21 AM5/22/19
to django...@googlegroups.com

Abu Yusuf

unread,
May 22, 2019, 6:04:06 AM5/22/19
to django...@googlegroups.com
I did use this urls.py:

from django.conf.urls import url
from django.contrib import admin
from django.urls import path
# from microblog.admin import microblogs_admin_site

urlpatterns = [
path('admin/', admin.site.urls),
# url(r'^microblogs-admin/', microblogs_admin_site.urls),
]

sagar ninave

unread,
May 22, 2019, 6:08:54 AM5/22/19
to django...@googlegroups.com
image.png
image.png

sagar ninave

unread,
May 22, 2019, 6:12:38 AM5/22/19
to django...@googlegroups.com
i am also using same url.py



For more options, visit https://groups.google.com/d/optout.

Abu Yusuf

unread,
May 22, 2019, 6:15:02 AM5/22/19
to django...@googlegroups.com
It's middleware. Not middleware_classes: 

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
]

sagar ninave

unread,
May 22, 2019, 6:16:23 AM5/22/19
to django...@googlegroups.com
i have tried already

On Wed, May 22, 2019 at 11:45 AM sagar ninave <sagar...@gmail.com> wrote:
after doing this i am getting another error


For more options, visit https://groups.google.com/d/optout.


--

sagar ninave

unread,
May 22, 2019, 6:16:24 AM5/22/19
to django...@googlegroups.com
after doing this i am getting another error


For more options, visit https://groups.google.com/d/optout.

Abu Yusuf

unread,
May 22, 2019, 6:17:04 AM5/22/19
to django...@googlegroups.com

sagar ninave

unread,
May 22, 2019, 6:17:44 AM5/22/19
to django...@googlegroups.com

image.png

Abu Yusuf

unread,
May 22, 2019, 6:24:40 AM5/22/19
to django...@googlegroups.com
Don't know why this is happening. Try to create the application with django2.0
That's better.

sagar ninave

unread,
May 22, 2019, 6:26:05 AM5/22/19
to django...@googlegroups.com
ok sir, thank you so much helping me


For more options, visit https://groups.google.com/d/optout.

Abu Yusuf

unread,
May 22, 2019, 6:27:29 AM5/22/19
to django...@googlegroups.com
microblogg.zip

Abu Yusuf

unread,
May 22, 2019, 6:53:55 AM5/22/19
to django...@googlegroups.com
Is it running? 

sagar ninave

unread,
May 22, 2019, 7:05:07 AM5/22/19
to django...@googlegroups.com
yes it is running
what was the problem


For more options, visit https://groups.google.com/d/optout.

Abu Yusuf

unread,
May 22, 2019, 7:28:58 AM5/22/19
to django...@googlegroups.com
Nothing. I just changed the urls and middleware. That's it.
Look to the codebase and see the differences.

sagar ninave

unread,
May 22, 2019, 7:30:26 AM5/22/19
to django...@googlegroups.com

Abu Yusuf

unread,
May 22, 2019, 7:31:35 AM5/22/19
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages