Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python url模板标记使用后django中的NoReverseMatch at/错误_Python_Django_Django Templates_Django Views - Fatal编程技术网

Python url模板标记使用后django中的NoReverseMatch at/错误

Python url模板标记使用后django中的NoReverseMatch at/错误,python,django,django-templates,django-views,Python,Django,Django Templates,Django Views,我在使用模板{%url%}标记后出现此错误 NoReverseMatch at /index/ Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] 这是在我将href=“index”更改为href=“{%url”索引“%}”时发生的 我的网址是 url(r'^index/$', views.index, name='index'), 我试图删

我在使用模板
{%url%}
标记后出现此错误

NoReverseMatch at /index/

Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
这是在我将
href=“index”
更改为
href=“{%url”索引“%}”
时发生的

我的网址是

url(r'^index/$', views.index, name='index'),

我试图删除
$
,但仍然存在相同的错误?

您提供的
应用程序名称将用作URL的命名空间。您应该像这样将其包含在标记中:

href="{% url 'actual_app_name:index' %}"

请参阅。

您可能缺少url名称空间My urls.py的名称空间与应用程序中的名称空间相同。\u name='实际应用程序名称'