The new version of django path can not use regular expressions

Although the new version of the path replaces the previous url, but not directly write regular expressions in the route at the time of writing the route, or will not find the page.

Workaround
Use re_path

from django.urls import re_path,path

urlpatterns = [
    path('admin/', admin.site.urls),
    re_path('',views.edit),  #默认首页
]

 

Guess you like

Origin www.cnblogs.com/52py/p/12132569.html