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

Version 6 (modified by anonymous, 13 years ago) (diff)

--

Documentation on running apache as a frontend to a TurboGears server can be found at the  CherryPy Wiki.

One issue not addressed there is inconsistent character sets. The default Kid templates used by turbogears specify a charset of utf-8. The apache default charset, returned in the "Content-Type" header, is ISO-8859-1. This inconsistency will cause errors during validation and incorrect rendering of some characters on the client. Use this directive to override the apache default:

  AddDefaultCharset utf-8

You can also explicitly set the charset property in the content-type header from cherrypy

  cherrypy.response.headerMap["Content-Type"] += ";charset=utf-8"

that way, since a charset is specified, apache won't apply the default charset.

Note that you can't use _cpFilterList, you have to make the filter changes to the config file, like so:

[/]
baseUrlFilter.on = True
baseUrlFilter.useXForwardedHost = True

Another Example

Karl Guertin wrote a step by step set of instructions in  this message on using VirtualPathFilter? with Apache.

1. Put the following lines in your prodcfg.py:
path("/")
baseUrlFilter.on = True
baseUrlFilter.useXForwardedHost = True
2. In your app directory 'python setup.py bdist_egg' to create an
installable egg file.
3. Copy the egg to your server and easy_install your_app_name
4. Create an apache virtual host containing the following rules:
    RewriteEngine on
    RewriteRule ^(.*) http://127.0.0.1:8000$1 [P]
5. Restart apache

There are other things you can optionally do and caveats, but the
above should work just fine. I'm not 100% sure on the syntax of the
first step, I've only deployed using the old .cfg format. 

This page seemed like a logical place to capture these instructions. I haven't tried using this yet.