summaryrefslogtreecommitdiff
path: root/django/views/static.py
diff options
context:
space:
mode:
authorCollin Anderson <cmawebsite@gmail.com>2015-01-03 12:06:24 -0500
committerTim Graham <timograham@gmail.com>2015-01-05 10:51:52 -0500
commit3d2cae0896ee8026d1c2c5d31e4c4c8f74f2fef4 (patch)
tree1abf00da86cd8831b829124a32058ea589b78b3c /django/views/static.py
parent05f702b94ca4ad77236a1e299270e8014def02e6 (diff)
Fixed #24072 -- Added FileResponse for streaming binary files.
Diffstat (limited to 'django/views/static.py')
-rw-r--r--django/views/static.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/views/static.py b/django/views/static.py
index 2998688284..75e81eccd3 100644
--- a/django/views/static.py
+++ b/django/views/static.py
@@ -11,7 +11,7 @@ import posixpath
import re
from django.http import (Http404, HttpResponse, HttpResponseRedirect,
- HttpResponseNotModified, StreamingHttpResponse)
+ HttpResponseNotModified, FileResponse)
from django.template import loader, Template, Context, TemplateDoesNotExist
from django.utils.http import http_date, parse_http_date
from django.utils.six.moves.urllib.parse import unquote
@@ -63,8 +63,7 @@ def serve(request, path, document_root=None, show_indexes=False):
return HttpResponseNotModified()
content_type, encoding = mimetypes.guess_type(fullpath)
content_type = content_type or 'application/octet-stream'
- response = StreamingHttpResponse(open(fullpath, 'rb'),
- content_type=content_type)
+ response = FileResponse(open(fullpath, 'rb'), content_type=content_type)
response["Last-Modified"] = http_date(statobj.st_mtime)
if stat.S_ISREG(statobj.st_mode):
response["Content-Length"] = statobj.st_size