thl*_*ood 2 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.
为什么?我认为post/1485/匹配^post/(?P<post_id>\d+)/$
我的根URL配置是:
urlpatterns = patterns('',
    ...
    url(r'^post/', include('posts.urls')),
)
然后,我posts/urls.py是:
urlpatterns = patterns('',
    ...
    url(r'^post/(?P<post_id>\d+)/$', 'post.views.post_page'),
)
您当前的设置会匹配以下网址:
/post/post/1485/
请posts/urls.py样子:
urlpatterns = patterns('',
    ...
    url(r'^(?P<post_id>\d+)/$', 'post.views.post_page'),
)