我不知道这个问题是否与我将描述的问题相同,但它确实有相同的症状.不幸的是,在我写作时它仍然没有得到解决.
所以这是我的问题.我正在尝试将James Bennett的django-registration应用程序添加到我的django项目中.我已经完成了根据我的需求配置它 - 自定义模板和网址.就在我认为一切都很好的时候.我在NoReverseMatch
使用django-registration所需的自定义模板之一时遇到了错误{% url 'testing' item_id=123 %}
(我也尝试使用视图名称,myapp.views.test
而不是运气).有趣的是,我尝试reverse('testing', kwargs={'item_id':123})
在shell中,网址也很好.我认为在后端{% url %}
使用reverse()
但为什么我会得到不同的结果?
urls.py :(我网站的URLconf)
urlpatterns = patterns('myapp.views',
url(r'^test/(?P<item_id>\d+)/$', 'test', name='testing'),
)
Run Code Online (Sandbox Code Playgroud)
activation_email.txt :(所说的模板.请注意它是django-registration所要求的.txt扩展名中的故意,这不应该是问题的原因.)
{% comment %}Used to generate the body of the activation email.{% endcomment %}
Welcome to {{ site }}! Please activate your account by clicking on the following link:
{% url 'testing' item_id=123 %}
Note the activation link/code …
Run Code Online (Sandbox Code Playgroud)