2

The errors message is:

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.

Why? I think post/1485/ match ^post/(?P<post_id>\d+)/$

My root url config is:

urlpatterns = patterns('',
    ...
    url(r'^post/', include('posts.urls')),
)

Then, my posts/urls.py is:

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

1 回答 1

8

Your current setup would match URLs like this:

/post/post/1485/

Make posts/urls.py look like:

urlpatterns = patterns('',
    ...
    url(r'^(?P<post_id>\d+)/$', 'post.views.post_page'),
)
于 2012-08-16T02:57:54.850 回答