???????????? namespace
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了???????????? namespace相关的知识,希望对你有一定的参考价值。
?????????return ?????? ???????????? app name TE div turn namespace
??????name??????????????????Django?????????URL????????????????????????????????????????????????????????????name??????URL??????????????????
??????????????????????????????????????????name???????????????URL??????????????????????????????name?????????????????????URL?????????????????????????????????????????????????????????????????????
??????Django??????namespace??????
from django.conf.urls import url,include #????????????????????????????????????????????? urlpatterns = [ url(r???^aaa???, include("app01.urls"),namespace=???aaa???)), url(r???^bbb???, include("app02.urls"),namespace=???bbb???)), ]
#??????app01??????
from django.conf.urls import url from app01 import views app_name = "app01" urlpatterns = [ url(r???aaa/$???, views.aaa, name="index"), ]
def aaa(request): return HttpResponse(reverse("app01:index"))
#??????app02?????????????????????????????????name??????
from django.conf.urls import url from app01 import views app_name = "app02" urlpatterns = [ url(r???aaa/$???, views.aaa, name="index"), ]
def aaa(request): return HttpResponse(reverse("app02:index"))
????????????
#http://127.0.0.1/aaa/aaa/ # ????????? # /aaaaaa/
#http://127.0.0.1/bbb/aaa/
# ????????? # /bbbaaa/
以上是关于???????????? namespace的主要内容,如果未能解决你的问题,请参考以下文章