我試圖簡單地給一個應用程序url一個選項/headless/
,使其顯示不同的模板。django 1.10網址調度員不工作
我project/urls.py
有:
urlpatterns = [
url(r'^datastore/', include('datastore.urls')),
]
我app/urls.py
有:
app_name = 'datastore'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^datastore/(?P<headless>"headless"{1})/$', views.index,name='index'),
]
我得到一個404錯誤與上面。
我也試過:
url(r'^datastore/(?P<headless>"headless"?)/$',
url(r'^datastore/(?P<headless>\w{1})/$', views.index, name='index'),
url(r'^datastore/(?P<headless>\w+)/$', views.index, name='index'),
* DOH * ...得到它'網址(R '^(θP無頭{1})/ $',views.index,名稱= '指數'),' –