1. 程式人生 > >django Url分發

django Url分發

django Url層級分發

from django.conf.urls import url

urlpatterns = [
    path('admin/', admin.site.urls),
    path('login/', views.login),
    path('index/', views.index),
    url(r'^myurl/$',([
        url(r'^test01/$',test01),#一層分發
        url(r'^test02/$',([
            url(r'^test04/$',test04),#二層分發
            url(r'^test05/$',test05),#二層分發
                          ],None,None)),),
        url(r'^test03/$',test03,#一層分發
                    ],None,None)),#後面兩個None是必帶的兩個引數None
]