未找到带有参数“()”和关键字参数“{}”的“索引”的反向操作。尝试了 0 个模式:[]

2024-04-22

我正在尝试让 django-register 在我的网站上工作,但我不断收到此错误,我不明白

我在 Python 3.3 上使用 django 1.6

NoReverseMatch at /accounts/register/
Reverse for 'index' with arguments '()' and keyword arguments '{}' not     found. 0 pattern(s) tried: []
    Request Method: GET
Request URL:    http://127.0.0.1:8000/accounts/register/
Django Version: 1.6.1
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Exception Location: D:\Programming\Py33\lib\site-packages\django\core\urlresolvers.py in _reverse_with_prefix, line 429
Python Executable:  D:\Programming\Py33\python.exe
Python Version: 3.3.3
Python Path:    
['D:\\Programming\\GItHub\\photobyte\\PhotoByte',
 'D:\\Programming\\Py33\\lib\\site-packages\\setuptools-2.0.3dev-py3.3.egg',
 'C:\\WINDOWS\\SYSTEM32\\python33.zip',
 'D:\\Programming\\Py33\\DLLs',
 'D:\\Programming\\Py33\\lib',
 'D:\\Programming\\Py33',
 'D:\\Programming\\Py33\\lib\\site-packages']
Server time:    Wed, 8 Jan 2014 02:49:17 -0800
Error during template rendering

这是错误的html代码

抱怨14号线

In template D:\Programming\GItHub\photobyte\PhotoByte\templates\base.html, error at line 14
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
4   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5   
6   <head>
7       <link rel="stylesheet" href="/style.css" />
8       <title>{% block title %}User test{% endblock %}</title>
9   </head>
10  
11  <body>
12      <div id="header">
13          {% block header %}
14      <a href="{% url 'index' %}">{% trans "Home" %}</a> | 
15  
16      {% if user.is_authenticated %}
17      {% trans "Logged in" %}: {{ user.username }} 
18      (<a href="{% url 'auth_logout' %}">{% trans "Log out" %}</a> | 
19      <a href="{% url 'auth_password_change' %}">{% trans "Change password" %}</a>)
20      {% else %}
21      <a href="{% url 'auth_login' %}">{% trans "Log in" %}</a>
22      {% endif %}
23      <hr />
24          {% endblock %}

这是我的项目的 Urls.py

urlpatterns = patterns('',
    (r'^ImageUpload/', include('ImageUpload.urls')),
    (r'^accounts/', include('registration.backends.default.urls')),
    (r'^$', RedirectView.as_view(url='/ImageUpload/list/')), # Just for ease of use.
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

有人可以解释一下这个错误是什么意思吗?


它抱怨第 14 行,因为 Django 无法确定 urls.py 文件中名为“index”的 url。我在上面没有看到名为“index”的 URL。您的主页的 URL 模式在哪里/是什么?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

未找到带有参数“()”和关键字参数“{}”的“索引”的反向操作。尝试了 0 个模式:[] 的相关文章

随机推荐