Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.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 Django URL没有';不匹配任何URL配置_Python_Django_Design Patterns_Django Urls - Fatal编程技术网

Python Django URL没有';不匹配任何URL配置

Python Django URL没有';不匹配任何URL配置,python,django,design-patterns,django-urls,Python,Django,Design Patterns,Django Urls,错误消息是: Using the URLconf defined in Blog.urls, Django tried these URL patterns, in this order: ^admin/doc/ ^admin/ ^post/ ^post/(?P<post_id>\d+)/$ The current URL, post/1458/, didn't match any of these. 然后,我的posts/url.py是: urlpatterns = patt

错误消息是:

Using the URLconf defined in Blog.urls,
Django tried these URL patterns, in this order:

^admin/doc/
^admin/
^post/ ^post/(?P<post_id>\d+)/$

The current URL, post/1458/, didn't match any of these.
然后,我的
posts/url.py
是:

urlpatterns = patterns('',
    ...
    url(r'^post/(?P<post_id>\d+)/$', 'post.views.post_page'),
)
urlpatterns=patterns(“”,
...
url(r“^post/(?P\d+/$”,“post.views.post_page”),
)

您当前的设置将与如下URL匹配:

/post/post/1485/
使
posts/url.py
看起来像:

urlpatterns = patterns('',
    ...
    url(r'^(?P<post_id>\d+)/$', 'post.views.post_page'),
)
urlpatterns=patterns(“”,
...
url(r'^(?P\d+/$,'post.views.post_page'),
)

Classic。我见过很多Django新手犯这种错误。
urlpatterns = patterns('',
    ...
    url(r'^(?P<post_id>\d+)/$', 'post.views.post_page'),
)