标签:通过 配置 from 访问 路由 project django 多个 clu
问题阐述:如何管理多个app下的路由分发,使得管理更加清晰?
from django.conf.urls import url from django.urls import path,re_path from myapp.views import IndexView urlpatterns = [ url(r‘index/$‘, IndexView.as_view(),name="mpapp_index"), path(r‘index/‘, IndexView.as_view(),name="mpapp_index") ]
from django.conf.urls import url, include from django.urls import url,path,include from django.contrib import admin urlpatterns = [ url(r‘^admin/‘, admin.site.urls), url(r‘^myapp/‘, include("myapp.urls")), path(r‘myapp/‘,include("myapp.urls")),#包含myapp中的urls ]
通过localhost:8000/myapp/index/访问该页面
标签:通过 配置 from 访问 路由 project django 多个 clu
原文地址:https://www.cnblogs.com/zenan/p/10196205.html