kopia lustrzana https://github.com/wagtail/wagtail
Remove remaining references to SiteMiddleware
rodzic
4279a17e87
commit
76cd26b099
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -59,7 +59,6 @@ MIDDLEWARE = [
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
||||
]
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue