Sasha Hart | 3 Apr 2012 05:33
Favicon

Re: Simple entry point discovery (was: A more useful command-line wsgiref.simple_server?)

On Mon, Apr 2, 2012 at 12:08 AM, Graham Dumpleton
<graham.dumpleton <at> gmail.com> wrote:
>
> 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.

That's a clever trick for CGI and a great reason to +x a script, since
it's so helpful to people who need to deploy against CGI for any
reason, but don't want to couple to CGI in the long run.

I wouldn't personally use hashbangs with wsgiref because if I can run
a Python interpreter, I have equal access to excellent pure-Python
servers which are - not to slight wsgiref - miles ahead (e.g.
concurrent requests, easy config, reloading). And it's not unlikely
that I can just deploy locally on the same server I use in production.

(Continue reading)


Gmane