Christopher Arndt wrote:
> Lukasz Szybalski schrieb:
> > On Wed, Jul 30, 2008 at 9:03 AM, Christoph Zwerschke <c...
> >> So ideally, I'd like to allow both kinds of URLs for my applications at
> >> the same time. But the problem is that you can set only one root path in
> >> TG using server.webpath.
> > Is there a reason you are not using mod_wsgi deployment to achieve above ?
> That's beside the question. Or can you show a way to solve the original
> problem (running the application under two different webpaths) with
The issue is whether TG is a true WSGI friendly application or not. If
TG is a good WSGI citizen, then it should honour the SCRIPT_NAME
variable passed in by a WSGI adapater as being the mount point of the
application. That is, SCRIPT_NAME should be used in preference to
server.webpath, especially if server.webpath is not defined.
If TG honours this, then using mod_wsgi one could do the following:
# Create WSGIDaemonProcess outside of VirtualHost so can be
# delegated to by mulitple virtual hosts.
# Allow access to WSGI script file for application.
# Delegate this TG application to 'appname' daemon process and
# specifically the main interpreter in that process. Need to specify
# application group else different mount points across virtual hosts
# would result in there being multiple instances in process. Forcing
# it to main interpreter means there will be only one instance of
# application regardless of where it is mounted.
Allow from all
# Virtual host for appname.company.com.
WSGIScriptAlias / /usr/local/turbogears/mysite/apache/
# Virtual host for main company site.
WSGIScriptAlias /appname /usr/local/turbogears/mysite/apache/
In other words, create a single daemon process and delegate the TG
application to run in main interpreter in that process via directives
in Directory container where TG WSGI script file is saved.
Different virtual hosts can then mount the WSGI script file at
different mount points and all requests will go to single TG app in
the single daemon process.
As mentioned above, this depends on SCRIPT_NAME being honoured for the
mount point. Any URL construction should also honour that and the
server name, protocol etc as described in WSGI PEP at:
The question therefore is whether TG has been updated to be a well
behaved WSGI application yet as doing what is required is certainly
straight forward using mod_wsgi if it were. Based on documentation in:
for TG 1.X it doesn't however honour SCRIPT_NAME, but has TG 2.0 fixed
this so it is?