路由系统
include原理,自写include方法
urlpatterns = [ path('admin/', admin.site.urls), url('^rbacc/',include(('app01.urls','app01'))), url(r'^rbac/', ([ url('x1/',views.login,name='login'), url('x2/',([ (url('xx1/',views.xx1)), url('xx2/',views.xx2,name='xx2') ], 'ap1',None))], 'aaa',None)), ]
view中反向路由解析
from django.urls import reverse def login(request): url1=reverse('aaa:ap1:xx2') print(url1)