Merge pull request #176 from johnthagen/fix-nginx-code-snippets

Fix the code snippets in the NGINX documentation page
This commit is contained in:
Rémy HUBSCHER 2021-01-27 10:06:57 +01:00 committed by GitHub
commit 563b2a4f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ Let's consider the following view:
.. literalinclude:: /../demo/demoproject/nginx/views.py
:language: python
:lines: 1-6, 8-16
:lines: 1-6, 8-17
What is important here is that the files will have an ``url`` property
implemented by storage. Let's setup an optimization rule based on that URL.
@ -46,26 +46,26 @@ Setup XAccelRedirect middlewares
********************************
Make sure ``django_downloadview.SmartDownloadMiddleware`` is in
``MIDDLEWARE_CLASSES`` of your `Django` settings.
``MIDDLEWARE`` of your `Django` settings.
Example:
.. literalinclude:: /../demo/demoproject/settings.py
:language: python
:lines: 63-70
:lines: 62-69
Then set ``django_downloadview.nginx.XAccelRedirectMiddleware`` as
``DOWNLOADVIEW_BACKEND``:
.. literalinclude:: /../demo/demoproject/settings.py
:language: python
:lines: 76
:lines: 75
Then register as many ``DOWNLOADVIEW_RULES`` as you wish:
.. literalinclude:: /../demo/demoproject/settings.py
:language: python
:lines: 84-89
:lines: 83-88
Each item in ``DOWNLOADVIEW_RULES`` is a dictionary of keyword arguments passed
to the middleware factory. In the example above, we capture responses by