The Occasional Occurence
Deploying CherryPy (or other Python web) Applications
February 09, 2006 at 10:34 AM | categories: Python, cherrypy, GeneralI have been thinking lately about how it is still pretty involved to deploy a CherryPy (or any Python web) application to a "production" server (Apache, lighttpd, IIS, etc).
The easiest method that I know at this point is mod_proxy with Apache:
Virtualhost *
ServerName cpsite.server.domain
CustomLog "/var/log/apache/cpsite/access_log" combined
ErrorLog /var/log/apache/cpsite/error_log
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
/Virtualhost
As long as the "cpsite" app is running on port 8081, everything should be cool.
If you are running Apache 2, you can even do this (grabbed from the CP wiki):
Location /myapp ProxyPass http://localhost:8080 ProxyPassReverse http://localhost:8080 RequestHeader set CP-Location /myapp /Location
If you want to do WSGI, it starts getting quite a bit more complicated. You need FCGI or SCGI or mod_python support for Apache and a handful of other Python libraries/modules to glue your (CP) WSGI app to the production server.
Are there any other easier ways that I am missing?
One thing that I like about the way PHP works is how easy it is to deploy apps. It usually works like this.
- Stick app's folder somewhere in your document root
- Modify the app's config.php file
- (maybe) Browse to http://theserver/theapp/install.php and follow the steps
That's pretty simple. *sigh*
Dreaming of mod_wsgi,
cw