在/admin/Reverse进行NoReverseMatch进行'登出'带参数'()'和关键字参数' {}'未找到

在/admin/Reverse进行NoReverseMatch进行'登出'带参数'()'和关键字参数' {}'未找到

问题描述:

我已阅读这一个,但我使用Django 1.5和我的urls.py看起来像这样:

I have read this one, but I am using Django 1.5 and my urls.py do looks like this:

url(r'^admin/$', include(admin.site.urls)),

由于注销存在问题,我将向您显示我拥有一个应用程序帐户,并且在urls.py根目录中,它看起来像:

since there is something wrong about the logout, I will show you that I have a app accounts,and in the root urls.py it looks like:

url(r'^accounts/', include('accounts.urls', namespace="accounts")),

在accounts/urls.py中,有一些关于注销的信息,如下所示:

and in accounts/urls.py,there is something about logout, it looks like this:

url(r'^logout/$', views.logout, name='logout'),

那么任何人都可以告诉我这怎么引起这个错误?非常感谢.

so can any one tell me how can this cause this bug? Thank you very much.

您的问题是

url(r'^admin/$', include(admin.site.urls)),

$ 表示正则表达式模式的结尾,并且不会考虑 include .

$ indicates end of a regex pattern, and the include would not be considered.

将其更改为

url(r'^admin/', include(admin.site.urls)),