Django - No User Matches the Given query

Asked

Viewed 159 times

0

Good afternoon, I’m new to Django and I’m making the following mistake: inserir a descrição da imagem aqui

I can’t access admin. I’ve checked the url several times and it’s all right. Until a day ago I was accessing the admin normally.

2 answers

0

2 things for you to check.

  1. Conflict of routes.
  2. If you have the admin in the INSTALLED_APPS tuple in Settings.py.
  • Hummm I checked the routes and they are all correct. And in Settings is the admin. INSTALLED_APPS = [ 'Django.contrib.admin'.

  • It’s the second time I have this problem. The first time I had to create a new project and migrate all apps.

  • You can put your urls.py as it is.?

  • urlpatterns = path('admin/', admin.site.urls, name='admin'), path('login/', auth_views.login, name='login'), path('logout/', auth_views.logout, name='logout'), path('main/', include('main.urls'), ='main name'), path('courses/', include('courses.urls'), name='courses'), path('personal/', include('personal.urls'), name='personal'), path('Members/', include('Members.urls'), name='Members'), path('blog/', include('blog.urls'), name='blog'), path('shop/', include('shop.urls'), name='shop'), ]

  • from Django.contrib import admin url(r' admin/', admin.site.urls),

  • url(r' admin/', admin.site.urls), Nameerror: name 'url' is not defined

  • And it’s not just the admin that I can’t access. Any page returns the image error.

  • The user is in the database as admin?

  • there are 3 registered users.

  • The q vc is logged in exists in the database? Have you tried to enter the tab anonymously?

  • I didn’t even log in! rs try to log in to Chrome’s anonymous mode? The same error already occurs!

Show 6 more comments

0

Solved. The problem was when I was logging out. When trying to open the login screen, there was a middleware trying to access the request.user that had already been deleted. Thank you Micael. Hugs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.