在URL.py文件中写入代码:
from django.urls import path
from . import views
urlpatterns = [
path(r'^index/$', views.index),
path(r'^article/(?P<article_id>[0-9]+)/$', views.article_page),
]
网页请求出错404:Using the URLconf defined in myblog.urls, Django tried these URL patterns, in this order:
admin/
blog/ ^index/$
blog/ ^article/(?P<article_id>[0-9]+)/$
The current path, blog/index/, didn't match any of these.应该是正则表达式没有起作用,显示匹配不到url,请问怎么解决?
添加回答
举报
0/150
提交
取消