0
我知道在每個應用程序中,我們可以使用自己的urlpatterns並使用include將其包含在主項目/應用程序中。可能將同一應用程序的urlpatterns分組?django
我想知道如果一個應用程序有幾個不同的網址,有沒有辦法將它分組?
例如
urlpatterns = [
url(r'^user/$', hello.asView(),
url(r'^user/hello/$', hello.asView(),
url(r'^user/there/$', hello.asView(),
url(r'^user/here/$', hello.asView(),
url(r'^user/that/$', hello.asView(),
url(r'^user/mini/$', hello.asView(),
url(r'^user/max/$', hello.asView(),
url(r'^bb/$', hello.asView(),
url(r'^bb/hello/$', hello.asView(),
url(r'^bb/there/$', hello.asView(),
url(r'^bb/here/$', hello.asView(),
url(r'^bb/that/$', hello.asView(),
url(r'^bb/mini/$', hello.asView(),
url(r'^bb/max/$', hello.asView(),
]
請忽略所有的hello.asView()
,但我想知道如果有一種方法將所有的user
和bb
所以如果有多個URL,我不需要繼續鍵入user
還是bb
?
在此先感謝您的幫助。