Running unmodified CGI scripts persistently under mod_wsgi.

Jeffrey Froman jeffrey at fro.man
Fri Dec 7 18:00:10 EST 2007


Jeffrey Froman wrote:

> While recently
> considering whether to re-write a standalone mod_python application as CGI
> or WSGI, I was scared off by this paragraph from PEP333:
<snip scary warning about using WSGI as an application API>

As a followup, I did go ahead and convert my CGI handler to WSGI, and doing
so was not difficult at all. The steps were basically:

1. accept environ and start_response parameters in the handler's __init__
2. return output from __iter__ instead of writing it to stdout.
3. pass environ and wsgi.input to the cgi.FieldStorage() parser.

I'd still be interested in a mod_wsgi wrapper for 3rd-party CGI scripts.


Thank you,
Jeffrey





More information about the Python-list mailing list