#34390 closed Bug (invalid)

NoReverseMatch at /admin/logout/

Reported by: Robert Palmer Owned by: nobody
Component: contrib.admin Version: 4.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

New project running Django 4.1.7 and when I click logout from the admin interface I get NoReverseMatch error.

The admin path is being added to the root urls file like this:

from django.contrib import admin

urlpatterns = [
...
path('admin/', admin.site.urls),
...
]

It looks like all of the other route paths are using a wrap() function except for the login path. (https://github.com/django/django/blob/main/django/contrib/admin/sites.py#L268)

Full error:

NoReverseMatch at /admin/logout/
Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
Request Method:	POST
Request URL:	http://localhost:8000/admin/logout/
Django Version:	4.1.7
Exception Type:	NoReverseMatch
Exception Value:	
Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
Exception Location:	/code/lib/python3.11/site-packages/django/urls/resolvers.py, line 828, in _reverse_with_prefix
Raised during:	django.contrib.admin.sites.logout
Python Version:	3.11.2
Server time:	Tue, 07 Mar 2023 17:42:54 +0000

Change History (1)

comment:1 by Mariusz Felisiak, 14 months ago

Resolution: invalid
Status: newclosed

Thanks for the report, however the admin works for me. If you're having trouble understanding how Django works, see TicketClosingReasons/UseSupportChannels for ways to get help.

Note: See TracTickets for help on using tickets.
Back to Top