bin/pngtile.fcgi
changeset 124 a5e66a48b959
parent 42 a5bca7b0cd8a
child 129 305f6d590440
equal deleted inserted replaced
110:81a0afb4b229 124:a5e66a48b959
     1 #!/usr/bin/env python2.5
     1 #!/usr/bin/env python2.5
     2 
     2 
     3 import flup.server.fcgi
     3 import flup.server.fcgi
     4 
     4 
     5 def main (app, bind=None) :
     5 import memcache
     6     """
       
     7         Run as a non-threaded single-process non-multiplexed FastCGI server
       
     8     """
       
     9 
     6 
       
     7 def run_fastcgi (app, bind=None) :
    10     # create WSGIServer
     8     # create WSGIServer
    11     server = flup.server.fcgi.WSGIServer(app, 
     9     server = flup.server.fcgi.WSGIServer(app, 
    12         # try to supress threading
    10         # try to supress threading
    13         multithreaded=False, 
    11         multithreaded=False, 
    14         multiprocess=False, 
    12         multiprocess=False, 
    25     )
    23     )
    26     
    24     
    27     # run... threads :(
    25     # run... threads :(
    28     server.run()
    26     server.run()
    29 
    27 
       
    28 def main (bind=None) :
       
    29     """
       
    30         Run as a non-threaded single-process non-multiplexed FastCGI server
       
    31     """
       
    32 
       
    33     # open cache
       
    34     cache = memcache.Client(['localhost:11211'])
       
    35     
       
    36     # build app
       
    37     app = pngtile.wsgi.WSGIApplication(cache)
       
    38 
       
    39     # server
       
    40     run_fastcgi(app, bind)
       
    41 
    30 if __name__ == '__main__' :
    42 if __name__ == '__main__' :
    31     import pngtile.wsgi
    43     import pngtile.wsgi
    32 
    44 
    33     main(pngtile.wsgi.application)
    45     main()
    34 
    46