Add `NGINX_X_ACCEL_REDIRECT` setting. Check this instead of `DEBUG` when deciding to use the `X-Accel-Redirect` header.
parent
9751da0754
commit
736847a4d8
|
@ -69,3 +69,10 @@ USE_PIP_INSTALL
|
||||||
Default: `False`
|
Default: `False`
|
||||||
|
|
||||||
Whether to use `pip install .` or `python setup.py install` when installing packages into the Virtualenv. Default is to use pip.
|
Whether to use `pip install .` or `python setup.py install` when installing packages into the Virtualenv. Default is to use pip.
|
||||||
|
|
||||||
|
NGINX_X_ACCEL_REDIRECT
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Default: `False`
|
||||||
|
|
||||||
|
Enable this if you are using Nginx for improved file handling.
|
||||||
|
|
|
@ -306,7 +306,7 @@ def serve_docs(request, lang_slug, version_slug, filename, project_slug=None):
|
||||||
basepath = proj.translations_path(lang_slug)
|
basepath = proj.translations_path(lang_slug)
|
||||||
basepath = os.path.join(basepath, version_slug)
|
basepath = os.path.join(basepath, version_slug)
|
||||||
log.info('Serving %s for %s' % (filename, proj))
|
log.info('Serving %s for %s' % (filename, proj))
|
||||||
if not settings.DEBUG:
|
if getattr(settings, 'NGINX_X_ACCEL_REDIRECT', False):
|
||||||
fullpath = os.path.join(basepath, filename)
|
fullpath = os.path.join(basepath, filename)
|
||||||
mimetype, encoding = mimetypes.guess_type(fullpath)
|
mimetype, encoding = mimetypes.guess_type(fullpath)
|
||||||
mimetype = mimetype or 'application/octet-stream'
|
mimetype = mimetype or 'application/octet-stream'
|
||||||
|
|
Loading…
Reference in New Issue