Hi,

On Wed, Feb 10, 2010 at 11:09:29AM -0800, mrts wrote:
> On Feb 10, 5:24 pm, Tom Evans <tevans...@googlemail.com> wrote:
> > On Wed, Feb 10, 2010 at 3:09 PM, Jari Pennanen <jari.penna...@gmail.com> 
> > wrote:
> > > Hi!
> >
> > > I was wondering what is the status of branch branches/soc2009/http-
> > > wsgi-improvements 
> > > (http://github.com/django/django/tree/soc2009/http-wsgi-improvements
> > > )? I'm personally interested one bug it fixes, mainly ticket #2131
> > > (http://code.djangoproject.com/ticket/2131)
> 
> You don't need that fix to use efficient file serving.
> 
> Just use an empty response and set the X-Sendfile header manually if
> using
> Apache. If not, check your server documentation for the right header
> name.
> 
> E.g.:
> 
> response = HttpResponse()
> response['X-Sendfile'] = '/full/path/to/file'
> response['Content-Type'] = 'some/content_type'
> response['Content-Length'] = os.stat('/full/path/to/file').st_size
> response['Content-Disposition'] = 'attachment; filename="foo"'
> return response

This only works for use cases where you have an on-disk file to serve.  There
are plenty of situations where this may not be the case:

* Cloud storage services (e.g. Rackspace Cloud Files)
* Large data sets (e.g. data exports to CSV, XML)

Etc.

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.pytagsfs.org

Attachment: signature.asc
Description: Digital signature

Reply via email to