Andrew-liu / my_blog_tutorial

It's the example of the development of blog by Django and Pure.
382 stars 206 forks source link

url.py的问题 #26

Closed edward-yin closed 7 years ago

edward-yin commented 7 years ago

./my_blog/url.py中设置为url(r'^$',include('article.urls')), ./article/url.py中设置为 url(r'^$', views.home, name='home'), url(r'^(?P\d+)/$',views.detail,name = 'detail'), 然后在动态URL那一章中就无法成功运行了,报错内容如下 django.urls.exceptions.NoReverseMatch: Reverse for 'detail' with keyword arguments '{'id': 6}' not found. 1 pattern(s) tried: ['$(?P\d+)/$'] 最后我发现把./my_blog/url.py中设置为url(r'^article',include('article.urls')), 这样,然后打开127.0.0.1:8000/article时可以看到"home"页面,现在我应该如何修改才能通过访问127.0.0.1:8000直接看到"home"页面呢?