问题描述:

What could cause NoReverseMatch error if there is no mistakes in urls.py and template?

Take a look at urls.py:

website.urls:

from django.conf.urls.defaults import *

urlpatterns = patterns('',

url(r'^$','base.views.index', name='index'), # works fine

(r'^accounts/$', include('auth.urls')),

)

auth.urls:

from django.conf.urls.defaults import *

from auth.views import accounts

urlpatterns = patterns('',

url(r'^$' ,accounts, name='accounts'), #not working

)

Template with tag {% url accounts %} gives me an NoReverseMatch error. Why?

网友答案:

Remove $ from here:

(r'^accounts/$', include('auth.urls')),

$ means end of the line, which is not your case.

相关阅读:
Top