在/admin/Reverse进行NoReverseMatch进行'登出'带参数'()'和关键字参数' {}'未找到 [英] NoReverseMatch at /admin/ Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found

查看:56
本文介绍了在/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)),

这篇关于在/admin/Reverse进行NoReverseMatch进行'登出'带参数'()'和关键字参数' {}'未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆