[Tilecache] Apache2 mod_wsgi and Service.load(*cfgs)
Soenke J. Peters
peters+tilecache.openlayers.org at opcenter.de
Mon Mar 9 09:35:53 EDT 2009
Hi,
while trying to move tilecache from mod_python to mod_wsgi, I've run
into the problem that its config files were not read.
In TileCache.Service, there are some lines reading:
... = Service.load(*cfgs)
I thought that this *arguments syntax is only valid in the _definition_
of functions (please tell me, if I'm wrong, I'm new to Python)?
Finally, my working tilcecache.wsgi boils down to this (merely a
cut'n'paste, as I didn't want to touch TileCache.Service):
#!/usr/bin/python
#
# In Apache2's config:
# WSGIScriptAlias /tilecache /var/www/mapserver/tilecache/tilecache.wsgi
#
import os, sys
tilecachepath = '/var/www/mapserver/tilecache'
sys.path.append(tilecachepath)
from TileCache.Service import Service, wsgiHandler
cfgfiles = (os.path.join(tilecachepath, "tilecache.cfg"))
theService = {}
def wsgiApp (environ, start_response):
global theService
cfgs = cfgfiles
if not theService:
theService = Service.load(cfgs)
return wsgiHandler(environ, start_response, theService)
application = wsgiApp
Bye,
--
____ Soenke Jan Peters
|_ _| 22395 Hamburg, Germany
._|| E-Mail & Jabber/XMPP: peters at opcenter.de
WWW: http://opcenter.de, GnuPG Key-ID: 0xF358FDCA
More information about the Tilecache
mailing list