Fork me on GitHub

django开发问题总结
报错如下

NoReverseMatch at /blog/
Reverse for 'blog_detail' with keyword arguments '{'blog_id': 10}' not found. 1 pattern(s) tried: ['blog/detail/(?P[1-9]+)/$']

    url(r'^detail/(?P<blog_id>[1-9]+)/$', views.detail,name='blog_detail'),

改为

    url(r'^detail/(?P<blog_id>\d+)/$', views.detail,name='blog_detail'),
#或改为

    url(r'^detail/(?P<blog_id>[0-9]+)/$', views.detail,name='blog_detail'),
posted on 2019-11-24 13:01  anyux  阅读(120)  评论(0编辑  收藏  举报