On Wed, Jul 21, 2010 at 1:03 PM, Jens Hoffrichter
<[email protected]> wrote:
> Hi,
>
> On 21 July 2010 21:40, Mike Orr <[email protected]> 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.
> OK, this sounds exactly like what I need.
>
> Thanks for the hint!
>
>>> 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.
> This looks quite interesting, too, but I'm a bit concerned that I need
> to do it in dev (using paster) differently to doing it on production
> (apache/mod_wsgi). So, for the time being I'll probably stick with the
> FileApp (if Pylons 0.9.6.2 supports it, I just hope - you know, legacy
> pylons app ^^)
>
> But, if how Wichert mentioned, paster.FileApp could be configured to
> do that automatically (maybe with a switch in the ini file, and then
> triggering some sort of middleware), that would be great, too!

That has been suggested recently. The main impediment is that Paste is
in a feature slumber ("freeze" would be too strong a word). The main
development work now is to spin off useful parts of Paste into their
own packages.  Still, if somebody wants to propose an API or patch for
paste.fileapp, I'm sure the Paste list would be interested.  One issue
is that I think Apache and Nginx have completely different APIs for
sending files, so the implementation would have to accommodate those
servers and other future webservers.

Also, logically if the webserver is handling FileApp files, it's also
probably handing the public directory. Maybe Pylons could define a
single configuration switch for both features.

-- 
Mike Orr <[email protected]>

-- 
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