The SVN version of TG uses cherrypy-2.2.0-beta which, AFAIK, is not compatible with the mpcp script described at the other mod_python integration page.
I'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 (worker MPM) and a backported libapache2-mod-python2.4 package from Ubuntu (the package didn't install cleanly and some black drudgery had to be done in order 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 modpython2.3. (I'm a big fan of 2.4's syntax sugar so I couldn't resist :)
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!.
Place this script in your application's package (where controllers.py lives), let's say you call it myapp_modpython.py.
ServerName www.example.com ServerAdmin webmaster@example.com ServerSignature Off AddDefaultCharset utf-8SetHandler python-program PythonHandler wsgiref.modpython_gateway::handler PythonOption application cherrypy._cpwsgi::wsgiApp PythonOption import myapp_modpython # Switch it off when everything is working fine. PythonDebug on # This section can be skipped if you have no mod_deflate or don't want compression # Recipe stolen somewhere around the httpd.apache.org realms. # Insert filter SetOutputFilter DEFLATE # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png|ico)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content # For a little speed boost, you can let Apache serve (some of) your static files directly: Alias /static /home/alberto/yourapp/static Alias /favicon.ico /home/alberto/yourapp/static/images/favicon.icoHeader append Vary User-Agent env=!dont-vary SetHandler None AllowOverride None # FollowSymLinks is set for max. performance. For max security turn them off. # However, if someone can make symlink in your server, this is your least motive for concern :) Options -ExecCGI -Indexes -Multiviews +FollowSymLinks Order allow,deny allow from all ]]>
Should get you going. Most of the configuration options don't add much to the understanding of this topic, The important stuff are the Python* directives.
Important things to consider: