在django2.0的路由系统中,摒弃了1.x中的url,而改用path.需要导入path. from django.urls import path,re_path 在1.x中,使用url()即可实现正则匹配,但是在2.0中,是否使用正则需要使用不同的方式. path()无法使用正则:re_path()可以使用正则. from django.urls import include, re_path urlpatterns = [ re_path(r'^index/$', views.index…