django-URL之include函数(五)
发布时间:2020-12-15 17:07:16 所属栏目:大数据 来源:网络整理
导读:三种格式: (1)incude(module,namespace=None) from django.urls import path,include from book urlsurlpatterns = { path( '' ,include(urls) ) } module:模型文件,namespace:实例命名空间 (2)include(pattern_list) from . viewsextractpatterns =
三种格式: from django.urls import path,include from book urls urlpatterns={ path('',include(urls)) } module:模型文件,namespace:实例命名空间 (2)include(pattern_list) from . views extractpatterns='index'),path(index/',1)">''home/,} urlpatterns=) } pattern_list:可迭代的path()或re_path()清单 (3)include((pattern_list,app_namespace),namespace) app_namespace:app命名空间 ) path() } urlpatterns=newsapp')),1)">) } ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |