Reverse for 'logout' .. not found. 1 pattern(s) tried: [u'admin/$logout/$']

django, django-admin

Solution

you have to remove the `$` from the regexp because you are including urlpatterns, hence appending the second piece of URL.

EDIT: to be more clear, the `$` in a regular expression represents the end of the string, and it would make sense in an urlpattern that points directly in a view. but an urlpattern that `include`s another urlpattern is supposed to read only the first part of the URL, because the remaining part is read by the included one. from this the need to begin with `^` and to not append the `$`.

Problem

I am using Django 1.6.1 and I get this error at `/admin` The project is a new project with no additional models being used. ``` Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'admin/$logout/$'] ``` urls.py ``` urlpatterns = patterns('', url(r'^admin/$', include(admin.site.urls)), ) ``` Is there anything that I can add to the urls to solve this?

Original source