Wiki Navigation

CherryPy works much better when it runs for a long time unlike CGI scripts
which have a very short life time.
However sometimes there are occasions where CGI is the only way to deploy and
once you've used CherryPy you want to stick with it. Why go back to "import cgi"
when there is CherryPy?

Here is a hack to enable VERY SIMPLE cherry py scripts to be ran as a CGI
script. It is not going to work for any complex scripts that leverage CherryPy
features!

The first one will redirect to the 2nd one. For this type of CGI this is not
ideal but for scripts that take GET parameters this is required to ensure the
parameters get passed correctly. It is possible to allow the first URL form
(with the trailing slash omitted) to call the CGI directly without the
redirect, if you need this (and don't care about GET parameters) then
update cherrypy_cgi.py to change the line that reads:

I'm using this on sourceforge.net where I have CGI access but no control over
the web server (I don't even get to see the error logs from CGI). I really like
sourceforge and you can't complain about the price ;-)

Code/suggestions/feedback welcome. Hopefully it is useful to someone else
(probably a very small subset of CherryPy users).

Most of the credit/blame belongs to Jared (ninebelow) from the following post: