Merge pull request #366 from thirstydigital/no-nginx

Add `NGINX_X_ACCEL_REDIRECT` setting. Check this instead of `DEBUG` when...
rtd2
Eric Holscher 2013-04-02 19:44:31 -07:00
commit b380b86645
2 changed files with 8 additions and 1 deletions

View File

@ -69,3 +69,10 @@ USE_PIP_INSTALL
Default: `False`
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.

View File

@ -306,7 +306,7 @@ def serve_docs(request, lang_slug, version_slug, filename, project_slug=None):
basepath = proj.translations_path(lang_slug)
basepath = os.path.join(basepath, version_slug)
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)
mimetype, encoding = mimetypes.guess_type(fullpath)
mimetype = mimetype or 'application/octet-stream'