Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

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?

share|improve this question
up vote 13 down vote accepted

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 includes 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 $.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.