我试图简单地为应用程序 url 提供一个选项,/headless/
以使其显示不同的模板。
我的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'),