On Thursday, March 24, 2011 2:40:39 PM UTC+1, Kristaps Kūlis wrote:
>
> I wish to note that Nginx implements this feature differently than
> LigHTTPd and Apache2
> http://wiki.nginx.org/XSendfile ,
>
> Should django implementation consider that ?
>
> My proposal to implement would be:
>  1. HttpFileResponse which takes file location (relative to MEDIA_URL ?)
>  2. HttpFileResponse checks for settings.X_SENDFILE or
> settings.X_ACCEL_REDIRECT and modifies sets revelant headers
> (Content-Type, X-Sendfile, X-Accel-Redirect) etc. HttpFileResponse
> should fallback to outputting file if no accelerated redirect is
> available.
>  3. Update docs, showing example server config .
>  4. Tests
>
> I could provide patch, if design idea is ok .
>
You might also be interested in this ticket which goes a little bit further 
in abstracting file uploads and downloads not only for X-Sendfile, but also 
S3, App Engine, and other file hosting/serving solutions:
http://code.djangoproject.com/ticket/13960

The patch is not great. It's too complicated, both implementation-wise (esp. 
in django.forms) and usability-wise (esp. the transfer_id stuff which is 
used for assigning backends to uploads/downloads).

For the sake of completeness, here is a separate app with the same purpose:
http://www.allbuttonspressed.com/projects/django-filetransfers
The API can certainly be simplified some more and I plan to do that probably 
in May.

I hope some of this is useful to you.

Bye,
Waldemar

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to