Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 3 and Version 4 of ModPythonIntegration09


Ignore:
Timestamp:
02/08/06 15:35:49 (13 years ago)
Author:
alberto
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ModPythonIntegration09

    v3 v4  
    11= Turbogears 0.9-prerelease (using !CherryPy 2.2.0-beta) mod_python integration = 
    22 
    3 To be written soon.... Sorry 
     3The SVN version of TG uses cherrypy-2.2.0-beta which, AFAIK, is not compatible with teh mpcp script described at the other modpy integration page. 
     4 
     5I've managed to get it running using Robert Brewer's '''modpython_gateway.py'''. It has been tested on a Debian Sarge box, Apache 2.0.54 and a backported libapache2-mod-python2.4 package from Ubuntu (the package didn't install cleanly and some black drudgery had to be done to get it working by hand so I will not post it here yet, if there's some demand I might try to build a better backport). However, provided you can run your TG app with python2.3, you should be fine with Sarge's stock modpytyhon2.3. (I'm a big fan of 2.4's syntax sugar so I couldn't resist :) 
     6 
     7Here is a quick recipe: 
     8 
     9 * Install wsigiref, {{{ sudo easy_install wsgiref }}} should get you going. 
     10 * Download Robert's [http://projects.amor.org/misc/svn/modpython_gateway.py script] and place it inside wsgiref's package. 
     11 * You'll need to write a script to start your TG app as start-your.py will not work. It should be something like: 
     12 
     13{{{ 
     14#!py 
     15import pkg_resources 
     16pkg_resources.require("TurboGears") 
     17 
     18import cherrypy 
     19import turbogears 
     20 
     21turbogears.update_config(configfile="/home/alberto/yourapp/prodcfg.py") 
     22turbogears.update_config(modulename="yourapp.config") 
     23 
     24from yourapp.controllers import Root 
     25 
     26cherrypy.root = Root() 
     27cherrypy.server.start(initOnly=True, serverClass=None)                                                  
     28}}} 
     29 
     30 Make sure you don't make any reference to {{{sys.argv}}} (as modpython doesn't have a command line) and you use full paths (as Apache's working directory is /, like any well behaved unix daemon...). Don't forget to fix your paths and application name!. 
     31 
     32 Place this script in your application's package (where controllers.py lives) 
     33 
     34 * Now you should {{{sudo python setup.py install }}} your app, you can get away by {{{sudo python setup.py develop }}} it. But then you should make your application's directory writable by your Apache user (normally www-data) which you should '''by no means''' do on a production box (if you can't guess why, then you should not be running a production box ;) 
     35 
     36'' More to come when I finish my dinner ;) '' 
     37 
     38 
     39