[Tilecache] dynamic config

Christopher Schmidt crschmidt at metacarta.com
Wed Feb 13 08:28:13 EST 2008


On Wed, Feb 13, 2008 at 10:03:49AM +0100, Attila Csipa wrote:
> On Wednesday 13 February 2008 06:40:51 Eric Lemoine wrote:
> > I'm wondering: if you run TileCache under mod_python, will it be able
> > to see new config files added to tilecache.conf.d between two Apache
> > reloads?
> 
> I'm not too familiar with mod_python myself, but unless I'm misinterpreting 
> the code I'd say it should be able to see/reload new configs on a per request 
> basis, not just apache reloads.

Code in question:

theService = None

def handler (apacheReq):
    global theService
    options = apacheReq.get_options()
    cfgs    = cfgfiles
    if options.has_key("TileCacheConfig"):
        cfgs = (options["TileCacheConfig"],) + cfgs
    if not theService:
        theService = Service.load(*cfgs)
    return modPythonHandler(apacheReq, theService)

theService will stay alive so long as the Apache process lives. THis is
true of WSGI (which I thought you were using) as well. This will only
reload on the fly for CGI.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list