simpler x-accel-redirect support

This commit is contained in:
j 2010-09-15 18:46:31 +02:00
parent 7acf61684e
commit 495e04c1b5

View file

@ -15,8 +15,6 @@ def HttpFileResponse(path, content_type=None, filename=None):
if settings.XACCELREDIRECT: if settings.XACCELREDIRECT:
response = HttpResponse() response = HttpResponse()
response['Content-Length'] = os.stat(path).st_size response['Content-Length'] = os.stat(path).st_size
if not isinstance(settings.XACCELREDIRECT, bool):
path = path.replace(*settings.XACCELREDIRECT)
if path.startswith(settings.STATIC_ROOT): if path.startswith(settings.STATIC_ROOT):
path = settings.STATIC_URL + path[len(settings.STATIC_ROOT)+1:] path = settings.STATIC_URL + path[len(settings.STATIC_ROOT)+1:]
if path.startswith(settings.MEDIA_ROOT): if path.startswith(settings.MEDIA_ROOT):