正则表达式没办法用
为什么没办法像教程里一样用正则表达式
from django.contrib import admin from django.urls import include, path import re urlpatterns = [ path('admin/', admin.site.urls), path(r'^blog/', include('blog.urls')), ]
urlpatterns = [ path(r'^index/', views.index), ]
可是结果却是:
Page not found (404)Request Method:GET
Request URL:http://127.0.0.1:8000/blog/index/Using the URLconf defined in MyBlog.urls, Django tried these URL patterns, in this order:admin/^blog/The current path, blog/index/, didn't match any of these.You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.