Py学习  »  问与答

一个问题:Caught NoReverseMatch while rendering: u'myapp' is not a registered namespace

ithelloworld • 11 年前 • 7596 次点击  

Django 1.3

app/myapp/urls.py

from django.conf.urls.defaults import patterns, url

urlpatters = patterns(
    'myapp.views',

    # (略)
    url(r'^sub_name/download/$', 'another_download', name='another_download'),
)

templates/myapp/sub_name_list.html

<form method="post" action="{% url myapp:another_download %}">
  <input type="submit" name="csv_download" value="CSV Download" />                                                                                                                                                                                                
</form>

程序运行的时候提示:

Caught NoReverseMatch while rendering: u'myapp' is not a registered namespace

为什么说“myapp”这个命名空间没有注册呢?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/141
 
7596 次点击  
文章 [ 2 ]  |  最新文章 11 年前