[Web-SIG] A more useful command-line wsgiref.simple_server?
graham.dumpleton at gmail.com
Mon Apr 2 07:21:14 CEST 2012
On 2 April 2012 15:08, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> On 2 April 2012 14:54, Sasha Hart <s at sashahart.net> wrote:
>> I would personally not +x a module file just to serve an app with wsgiref
>> from the hashbang line; it's clever but I can't come up with any real
>> benefit. A case where I'm serving with wsgiref already has to be pretty
>> trivial and I'm not going to couple to it *from inside the module itself*
>> when it is so darned easy to just run the module from several nice python
>> test servers (also portable and I can use autoreload, etc.) But if this is
>> desired by many others, I'd agree it's a good factor to consider.
> When using CGI or FASTCGI, with a hosting system where an executable
> script needs to be supplied, it is beneficial to be able to say
> something like:
> #!/usr/bin/env python -m cgi2wsgi
> #!/usr/bin/env python -m fcgi2wsgi
> where the rest of the script is the just the WSGI application.
> I have implemented this for CGI as an example at:
> I have done it for FASTCGI using flup as well before but that isn't
> available anywhere.
I should probably add though that this is not the best way it could be
done for FASTCGI. For FASTCGI you are better off making use of FASTCGI
implementations wrapper mechanism as intermediary with it handling the
loading. This is the approach that PHP under FASTCGI uses and why it
is so easy for users, namely because system admins set it up with
wrapper support. You don't see such niceties for Python where a system
admin sets up that a .wsgi script file would be understood to be a
Python WSGI application with no extra magic needing to be added to it
by the user, even though not that difficult in principle. Thus why
users need to resort to #! line and low level FASTCGI script in the
More information about the Web-SIG