django - NoReverseMatch at /accounts/register/ -
i following getting started guide django registration , getting following error when visit http://localhost:8080/accounts/register/
:
noreversematch @ /accounts/register/ reverse 'index' arguments '()' , keyword arguments '{}' not found. request method: request url: http://localhost:8080/accounts/register/ django version: 1.5.1 exception type: noreversematch exception value: reverse 'index' arguments '()' , keyword arguments '{}' not found. exception location: /library/python/2.7/site-packages/django/template/defaulttags.py in render, line 424 python executable: /usr/bin/python python version: 2.7.1 python path: ['/users/studio/desktop/orro/t1/tut', '/library/python/2.7/site-packages/setuptools-0.9.8-py2.7.egg', '/system/library/frameworks/python.framework/versions/2.7/lib/python27.zip', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-darwin', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/system/library/frameworks/python.framework/versions/2.7/extras/lib/python', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/lib-tk', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/lib-old', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload', '/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/pyobjc', '/library/python/2.7/site-packages'] server time: mon, 12 aug 2013 18:53:54 -0500 error during template rendering in template /users/studio/desktop/pod/t1/tut/tut/templates/base.html, error @ line 16 reverse 'index' arguments '()' , keyword arguments '{}' not found. 6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 7 8 <head> 9 <link rel="stylesheet" href="/style.css" /> 10 <title>{% block title %}user test{% endblock %}</title> 11 </head> 12 13 <body> 14 <div id="header"> 15 {% block header %} 16 <a href="{% url 'index' %}">{% trans "home" %}</a> | 17 18 {% if user.is_authenticated %} 19 {% trans "logged in" %}: {{ user.username }} 20 (<a href="{% url 'auth_logout' %}">{% trans "log out" %}</a> | 21 <a href="{% url 'auth_password_change' %}">{% trans "change password" %}</a>) 22 {% else %} 23 <a href="{% url 'auth_login' %}">{% trans "log in" %}</a> 24 {% endif %} 25 <hr /> 26 {% endblock %}
my urls.py:
from django.conf.urls import patterns, include, url # uncomment next 2 lines enable admin: django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'tut.views.home', name='home'), # url(r'^tut/', include('tut.foo.urls')), # uncomment admin/doc line below enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # uncomment next line enable admin: url(r'^admin/', include(admin.site.urls)), (r'^accounts/', include('registration.backends.default.urls', namespace='registration')), )
any ideas?
the information need in traceback have provided,
in template /users/studio/desktop/pod/t1/tut/tut/templates/base.html, error @ line 16 reverse 'index' arguments '()' , keyword arguments '{}' not found.
in base.html
template, on line 16, using url tag link view named 'index'.
16 <a href="{% url 'index' %}">{% trans "home" %}</a> |
however, there no url pattern named index
in url patterns. therefore reverse fails, , raises noreversematch
exception.
you can fix creating index view in tut.views
module, , adding url patterns.
url(r'^$', 'tut.views.index', name='index'),
alternatively, can remove {% url 'index' %}
template until add index view.
Comments
Post a Comment