bin/pngtile.fcgi
author Tero Marttila <terom@fixme.fi>
Sat, 10 Apr 2010 22:18:41 +0300
changeset 127 df89d13f2354
parent 124 a5e66a48b959
child 129 305f6d590440
permissions -rwxr-xr-x
invert zl meaning; zl=0 is 100%, zl=+n is zoomed out
#!/usr/bin/env python2.5

import flup.server.fcgi

import memcache

def run_fastcgi (app, bind=None) :
    # create WSGIServer
    server = flup.server.fcgi.WSGIServer(app, 
        # try to supress threading
        multithreaded=False, 
        multiprocess=False, 
        multiplexed=False,
        
        # specify the bind() address
        bindAddress=bind,

        # leave as defaults for now
        umask=None,

        # XXX: non-debug mode?
        debug=True,
    )
    
    # run... threads :(
    server.run()

def main (bind=None) :
    """
        Run as a non-threaded single-process non-multiplexed FastCGI server
    """

    # open cache
    cache = memcache.Client(['localhost:11211'])
    
    # build app
    app = pngtile.wsgi.WSGIApplication(cache)

    # server
    run_fastcgi(app, bind)

if __name__ == '__main__' :
    import pngtile.wsgi

    main()