Issue #881 resolved

Support specifying multiple imports/function calls via PythonOption cherrypy.setup instead of just one.

Anonymous created an issue

This request is based on my quite possibly very flawed understanding of how CherryPy is intended to function under Apache via mod_python. So if there's a better way to do this, just let me know.

When deploying multiple CherryPy apps under Apache via mod_python, the _cpmodpy.py adapter calls the setup function once. This means that for multiple apps, I have to handle the setup for ALL of them in that single function or import.

What I would prefer the is ability to dictate which apps are loaded by Apache in the Apache config file, rather than an external Python file.

In short, I want to be able to use an Apache config file that looks more like this:

{{{ <Location /> PythonOption cherrypy.setup "foo_app.webservice::server_setup bar_app::server_setup baz_app::server_setup mysite_cp_engine_conf" </Location>

<Location /foo_app> SetHandler python-program PythonHandler cherrypy._cpmodpy::handler </Location>

<Location /bar_app> SetHandler python-program PythonHandler cherrypy._cpmodpy::handler </Location>

<Location /baz_app> SetHandler python-program PythonHandler cherrypy._cpmodpy::handler </Location> }}}

This is meant for requests like /index.html to be handled by Apache, while three independent applications (foo_app, bar_app, and baz_app) run under their respective mount points, and a mysite_cp_engine_conf is a module which sets up the engine configuration for CherryPy for the server.

The goal being that the apps being hosted under CherryPy can be verified and controlled all from within the Apache configuration file, rather than a combination of the Apache configuration file AND a separate Python file.

A patch to implement this with _cpmodpy.py revision 1989 (CherryPy 3.1.1) is attached.

Reported by erskin@eldritch.org

Comments (4)

  1. Log in to comment