NoReverseMatch错误 [英] NoReverseMatch Error

查看:277
本文介绍了NoReverseMatch错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断得到django登录系统的这个错误。这是我的urls.py的一部分:

I keep getting this error for the django login system. Here is part of my urls.py:

     (r'^contractManagement/login', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),

确切的错误我我得到:

Exception Type: NoReverseMatch
Exception Value:    Reverse for ''django.contrib.auth.views.login'' with arguments '()' and keyword arguments '{}' not found.

我不明白为什么我得到这个错误。如果你需要其他任何事情让我知道。

I can't understand why i am getting this error. If you need anything else let me know.

推荐答案

您不会显示您尝试颠倒此网址的位置,但您似乎已经双引号了。如果您使用 url 标记,请注意,您不需要在URL名称附近引用引号:

You don't show where you are trying to reverse this URL, but it looks like you have double-quoted it. If you're using the url tag, note that you don't need quotes around the url name:

{% url django.contrib.auth.views.login %}

not

{% url 'django.contrib.auth.views.login' %}

这篇关于NoReverseMatch错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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