Задать вопрос

Тел: +7 965 3737 888

398

Просмотров

2

Ответов

HttpResponseSendfile

<p>An HttpResponse for giving the user a file download, taking advantage of X-Sendfile if it's available, using FileWrapper if not.</p>
<p>Usage:</p>
HttpResponseSendfile('/path/to/file.ext')

<p>To bypass the fallback:</p>
HttpResponseSendfile('/path/to/file.ext', fallback=False)

<p>This has been tested working with Lighttpd 1.4.28's mod_fastcgi.</p>

Вопрос полезен? Да0/Нет0
file_2463.py(1.0Кб)
None

Ответы (2):

Ответmika:12.09.2013
Ответ полезен? Да0/Нет0

Had problem with X-Sendfile line, because path can have non-us chars. Fixed by adding encoding: self['X-Sendfile'] = path.encode('utf8')

Ответarthur:03.05.2012
Ответ полезен? Да0/Нет0

Note that there is also django-sendfile which also supports nginx's X-Accel-Redirect and more.