SCGI WSGI
This is a HOWTO. See BehindApache for a higher-level discussion.
A very simple setup lets your cherry run under SCGI (on apache in my setup). You need just a running apache server with mod_scgi and have the scgi python module installed. You also need an SCGI front end to WSGI. In this case, I'm using the SCGI-->WSGI application proxy, aka "SWAP" from Python Paste. Here's a direct link to SWAP. If that link doesn't work, you may have to hunt down SWAP on your own.
#!/usr/bin/python import cherrypy from paste.util.scgiserver import serve_application class HelloWorld: def index(self): return "Hello world!" index.exposed = True app = cherrypy.tree.mount(HelloWorld()) cherrypy.engine.start(blocking=False) serve_application(application=app, prefix="/dynamic", port=4000)
The Apache configuration that goes along with this is as follows:
<Location "/dynamic">
SCGIServer 127.0.0.1 4000
SCGIHandler On
</Location>
Older versions
2.2
This example uses the VirtualPathFilter? (not needed in CP 3); feel free to ignore it if you don't need it.
#!/usr/bin/python import cherrypy from virtualpathfilter import VirtualPathFilter from cherrypy._cpwsgi import wsgiApp from paste.util.scgiserver import serve_application class HelloWorld: """ Sample request handler class. """ _cpFilterList = [VirtualPathFilter()] def index(self): return "Hello world!" index.exposed = True cherrypy.root = HelloWorld() cherrypy.config.update({ '/': { 'server.environment': 'development', 'virtualPathFilter.on': True, 'virtualPathFilter.prefix': "/dynamic" } }) # init cp cherrypy.server.start(initOnly=True, serverClass=None) # run the server serve_application(application=wsgiApp, prefix="/dynamic", port=4000)

