On 2010-7-21 21:40, Mike Orr wrote:
On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson<[email protected]>  wrote:
Hello,

I think you want something like this.

from paste.fileapp import FileApp

#.... in controller ....
         #...in some action, get the path to serve
         wsgi_app = FileApp(path)
         return wsgi_app(request.environ, self.start_response)

Yes, use paste.fileapp.  You can just return the wsgi_app object
directly, and Pylons will call it for you.

A better solution you might want to look into is x-sendfile/x-accel-redirect
which let's you pass the path up to a proxying server via a header that it
can use to serve the file.  That way you can check permissions in your app
but still serve the file via apache/nginx/etc.

This is a more efficient method which some of us are starting to use.

Would be nice if FileApp can do that automatically itself. Or does it already?

Wichert.


--
Wichert Akkerman <[email protected]>   It is simple to make things.
http://www.wiggy.net/                  It is hard to make things simple.

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to