mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
Update references to middleware settings
This commit is contained in:
parent
338e17195f
commit
c51720296a
6 changed files with 9 additions and 17 deletions
|
|
@ -17,14 +17,7 @@ from django.core.exceptions import ImproperlyConfigured
|
|||
deprecated_middleware = "django_downloadview.nginx.XAccelRedirectMiddleware"
|
||||
|
||||
|
||||
def get_middlewares():
|
||||
try:
|
||||
return settings.MIDDLEWARE
|
||||
except AttributeError:
|
||||
return settings.MIDDLEWARE_CLASSES
|
||||
|
||||
|
||||
if deprecated_middleware in get_middlewares():
|
||||
if deprecated_middleware in settings.MIDDLEWARE:
|
||||
raise ImproperlyConfigured(
|
||||
"{deprecated_middleware} middleware has been renamed as of "
|
||||
"django-downloadview version 1.3. You may use "
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Here are tips to migrate from `django-sendfile` to `django-downloadview`...
|
|||
* setup ``DOWNLOADVIEW_RULES``. It replaces ``SENDFILE_ROOT`` and can do
|
||||
more.
|
||||
* register ``django_downloadview.SmartDownloadMiddleware`` in
|
||||
``MIDDLEWARE_CLASSES``.
|
||||
``MIDDLEWARE``.
|
||||
|
||||
4. Change your tests if any. You can no longer use `django-senfile`'s
|
||||
``development`` backend. See :doc:`/testing` for `django-downloadview`'s
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Setup XSendfile middlewares
|
|||
***************************
|
||||
|
||||
Make sure ``django_downloadview.SmartDownloadMiddleware`` is in
|
||||
``MIDDLEWARE_CLASSES`` of your `Django` settings.
|
||||
``MIDDLEWARE`` of your `Django` settings.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
@ -128,4 +128,4 @@ setup.
|
|||
|
||||
.. target-notes::
|
||||
|
||||
.. _`Apache mod_xsendfile documentation`: https://tn123.org/mod_xsendfile/
|
||||
.. _`Apache mod_xsendfile documentation`: https://tn123.org/mod_xsendfile/
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Setup XSendfile middlewares
|
|||
***************************
|
||||
|
||||
Make sure ``django_downloadview.SmartDownloadMiddleware`` is in
|
||||
``MIDDLEWARE_CLASSES`` of your `Django` settings.
|
||||
``MIDDLEWARE`` of your `Django` settings.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ There is no need to register this application in ``INSTALLED_APPS``.
|
|||
|
||||
|
||||
******************
|
||||
MIDDLEWARE_CLASSES
|
||||
MIDDLEWARE
|
||||
******************
|
||||
|
||||
If you plan to setup :doc:`reverse-proxy optimizations </optimizations/index>`,
|
||||
add ``django_downloadview.SmartDownloadMiddleware`` to ``MIDDLEWARE_CLASSES``.
|
||||
add ``django_downloadview.SmartDownloadMiddleware`` to ``MIDDLEWARE``.
|
||||
It is a response middleware. Move it after middlewares that compute the
|
||||
response content such as gzip middleware.
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ Example:
|
|||
See :doc:`/optimizations/index` for a list of available backends (middlewares).
|
||||
|
||||
When ``django_downloadview.SmartDownloadMiddleware`` is in your
|
||||
``MIDDLEWARE_CLASSES``, this setting must be explicitely configured (no default
|
||||
``MIDDLEWARE``, this setting must be explicitely configured (no default
|
||||
value). Else, you can ignore this setting.
|
||||
|
||||
|
||||
|
|
@ -119,5 +119,5 @@ See :doc:`/optimizations/index` for details about builtin backends
|
|||
(middlewares) and their options.
|
||||
|
||||
When ``django_downloadview.SmartDownloadMiddleware`` is in your
|
||||
``MIDDLEWARE_CLASSES``, this setting must be explicitely configured (no default
|
||||
``MIDDLEWARE``, this setting must be explicitely configured (no default
|
||||
value). Else, you can ignore this setting.
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ class DeprecatedAPITestCase(django.test.SimpleTestCase):
|
|||
def test_nginx_x_accel_redirect_middleware(self):
|
||||
"XAccelRedirectMiddleware in settings triggers ImproperlyConfigured."
|
||||
with override_settings(
|
||||
MIDDLEWARE_CLASSES=["django_downloadview.nginx.XAccelRedirectMiddleware"],
|
||||
MIDDLEWARE=["django_downloadview.nginx.XAccelRedirectMiddleware"],
|
||||
):
|
||||
with self.assertRaises(ImproperlyConfigured):
|
||||
|
|
|
|||
Loading…
Reference in a new issue