Update project template + docs to clarify that wagtail_urls should appear at the end of urlpatterns

This commit is contained in:
Matt Westcott 2017-01-13 17:06:52 +00:00
parent 1035d1445b
commit dd5ea07151
5 changed files with 26 additions and 0 deletions

View file

@ -88,6 +88,9 @@ Next, register the URLs so Django can route requests into the API:
url(r'^api/v2/', api_router.urls),
...
# Ensure that the api_router line appears above the default Wagtail page serving route
url(r'', include(wagtail_urls)),
]
With this configuration, pages will be available at ``/api/v2/pages/``, images

View file

@ -27,6 +27,11 @@ Add an entry for the view into your URLs configuration:
...
url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$', ServeView.as_view(), name='wagtailimages_serve'),
...
# Ensure that the wagtailimages_serve line appears above the default Wagtail page serving route
url(r'', include(wagtail_urls)),
]
Usage

View file

@ -20,5 +20,11 @@ To install, add ``wagtail.contrib.wagtailapi`` and ``rest_framework`` to ``INSTA
urlpatterns = [
...
url(r'^api/', include(wagtailapi_urls)),
...
# Ensure that the wagtailapi_urls line appears above the default Wagtail page serving route
url(r'', include(wagtail_urls)),
]

View file

@ -30,6 +30,11 @@ Then, in ``urls.py``, you need to add a link to the ``wagtail.contrib.wagtailsit
...
url('^sitemap\.xml$', sitemap),
...
# Ensure that the 'sitemap' line appears above the default Wagtail page serving route
url(r'', include(wagtail_urls)),
]

View file

@ -17,7 +17,14 @@ urlpatterns = [
url(r'^search/$', search_views.search, name='search'),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in
# the list:
url(r'', include(wagtail_urls)),
# Alternatively, if you want Wagtail pages to be served from a subpath
# of your site, rather than the site root:
# url(r'^pages/', include(wagtail_urls)),
]