标签:views event 二级路由 一级路由 log lap str app soft
Django 路由分发
当一个url请求过来之后
1、先到项目主目录下的urls内。
2、由这个url做处理分发给其他app内的urls。
一级路由:主目录urls内引入include
from django.conf.urls import url,include
urlpatterns = [ # 指定分发的app目录名称 url(r‘^cmdb/‘,include("app01.urls")), url(r‘^monitor/‘,include("app02.urls")), ]
二级路由:只查找本地urls内的路径
from django.conf.urls import url,include from app01 import views
urlpatterns = [ url(r‘^login/‘, views.login), ]
其他路由方案
urlpatterns = [ url(r‘^admin/‘, admin.site.urls), url(r‘^business$‘, views.business), #url(r‘^business_add‘, views.business), ]
标签:views event 二级路由 一级路由 log lap str app soft
原文地址:https://www.cnblogs.com/xiangsikai/p/10917795.html