[Web-SIG] A more useful command-line wsgiref.simple_server?

Graham Dumpleton graham.dumpleton at gmail.com
Mon Apr 2 07:08:06 CEST 2012


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:

  https://github.com/GrahamDumpleton/cgi2wsgi

I have done it for FASTCGI using flup as well before but that isn't
available anywhere.

Graham


More information about the Web-SIG mailing list