Django 路由分发
当一个url请求过来之后
1、先到项目主目录下的urls内。
2、由这个url做处理分发给其他app内的urls。
一级路由:主目录urls内引入include
![复制代码](https://common.cnblogs.com/images/copycode.gif)
from django.conf.urls import url,include
urlpatterns = [ # 指定分发的app目录名称 url(r'^cmdb/',include("app01.urls")), url(r'^monitor/',include("app02.urls")), ]
![复制代码](https://common.cnblogs.com/images/copycode.gif)
二级路由:只查找本地urls内的路径
![复制代码](https://common.cnblogs.com/images/copycode.gif)
from django.conf.urls import url,include from app01 import views
urlpatterns = [ url(r'^login/', views.login), ]
![复制代码](https://common.cnblogs.com/images/copycode.gif)