Skip to content

Commit

Permalink
Merge pull request #176 from johnthagen/fix-nginx-code-snippets
Browse files Browse the repository at this point in the history
Fix the code snippets in the NGINX documentation page
  • Loading branch information
Natim authored Jan 27, 2021
2 parents 9b5fee2 + 707c392 commit 563b2a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/optimizations/nginx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 563b2a4

Please sign in to comment.