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

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
pull/5736/head
Nick Smith 2019-12-12 15:34:17 +00:00 zatwierdzone przez Matt Westcott
rodzic cbd0882354
commit 7acf4889db
3 zmienionych plików z 13 dodań i 8 usunięć
docs/releases
wagtail/project_template/project_name

Wyświetl plik

@ -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)
~~~~~~~~~~~~~~~~~~~~

Wyświetl plik

@ -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

Wyświetl plik

@ -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)),
]