Remove remaining references to SiteMiddleware

pull/5837/head
Matt Westcott 2020-01-24 12:43:07 +00:00
rodzic 4279a17e87
commit 76cd26b099
4 zmienionych plików z 2 dodań i 11 usunięć

Wyświetl plik

@ -35,16 +35,12 @@ In your settings file, add the following apps to ``INSTALLED_APPS``:
'modelcluster',
'taggit',
Add the following entries to ``MIDDLEWARE``:
Add the following entry to ``MIDDLEWARE``:
.. code-block:: python
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
.. note::
Wagtail is currently incompatible with projects using ``django.contrib.sites.middleware.CurrentSiteMiddleware``, as both this and ``wagtail.core.middleware.SiteMiddleware`` set the attribute ``request.site``.
Add a ``STATIC_ROOT`` setting, if your project does not have one already:
.. code-block:: python

Wyświetl plik

@ -57,9 +57,6 @@ def settings(request):
site = Site.find_for_request(request)
if site is None:
# find_for_request() can't determine the site
# old SiteMiddleware case
# Unittest or email templates might also mock request
# objects that don't have a request.site.
return {}
else:
return SettingsProxy(site)

Wyświetl plik

@ -8,8 +8,7 @@ from wagtail.core.models import Page, PageViewRestriction, Site
def serve(request, path):
# we need a valid Site object corresponding to this request (set in wagtail.core.middleware.SiteMiddleware)
# in order to proceed
# we need a valid Site object corresponding to this request in order to proceed
site = Site.find_for_request(request)
if not site:
raise Http404

Wyświetl plik

@ -59,7 +59,6 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]