0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Move wagtail_urls to the end of template urls.py (#5733)

The `wagtail_urls` patterns is a catch-all list of urlpatterns, and will
prevent any patterns later in the list from being matched. The default
case when Django is in debug mode for local development is to use
`django-admin.py runserver`, and in this case the static patterns in the
example [are redundant][1]. However for anyone using a different server
for local development, this makes them work again.

[1]: https://docs.djangoproject.com/en/3.0/howto/static-files/#serving-static-files-during-development
This commit is contained in:
Nick Smith 2019-12-12 15:34:17 +00:00 committed by Matt Westcott
parent cbd0882354
commit 7acf4889db
3 changed files with 13 additions and 8 deletions

View File

@ -28,6 +28,7 @@ Changelog
* Fix: All templates with wagtailsettings and modeladmin now use `block.super` for `extra_js` & `extra_css` (Timothy Bautista)
* Fix: Layout issue when using FieldRowPanel with a heading (Andreas Bernacca)
* Fix: `file_size` and `file_hash` not updated when Document file changed (Andreas Bernacca)
* Fix: Fixed order of URLs in project template so that static / media URLs are not blocked (Nick Smith)
2.7 LTS (06.11.2019)
~~~~~~~~~~~~~~~~~~~~

View File

@ -42,6 +42,7 @@ Bug fixes
* All templates with wagtailsettings and modeladmin now use ``block.super`` for ``extra_js`` & ``extra_css`` (Timothy Bautista)
* Layout issue when using FieldRowPanel with a heading (Andreas Bernacca)
* ``file_size`` and ``file_hash`` not updated when Document file changed (Andreas Bernacca)
* Fixed order of URLs in project template so that static / media URLs are not blocked (Nick Smith)
Upgrade considerations

View File

@ -16,14 +16,6 @@ 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)),
]
@ -34,3 +26,14 @@ if settings.DEBUG:
# Serve static and media files from development server
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns = urlpatterns + [
# 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)),
]