> >
> > My current plan is the following:
> > 1. capture the file request url and direct it a view.
> > 2. check user permissions
> > 3. Get Python to construct the correct MIME header then read the
> > requested file from disk and pipe it through to the user.
> >
> > If this is the best solution then what would be the most CPU efficient
> > way to read a file in and send it over HTTP?


In Satchmo, I recently added a secure file download option that I think
implements similar functionality.  You can see the view here -
http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/views/download.py

The key is the use of the x-sendfile  (or X-LIGHTTPD-send-file) in the
headers.  If properly configured, this will tell Apache or Lighttpd to send
that file directly from the filesystem.  In this way,  Django doesn't get
bogged down with the file system and you have the option to do as much
checking as you want (in Django) before sending the file.  It's been pretty
straightforward so far but I haven't extensively tested it.

-Chris

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

Reply via email to