fix pngtile.fcgi
authorTero Marttila <terom@fixme.fi>
Wed, 27 Jan 2010 01:10:58 +0200
changeset 124 a5e66a48b959
parent 110 81a0afb4b229
child 125 66a53ca73e91
fix pngtile.fcgi
bin/pngtile.fcgi
--- a/bin/pngtile.fcgi	Tue Jan 26 16:52:18 2010 +0200
+++ b/bin/pngtile.fcgi	Wed Jan 27 01:10:58 2010 +0200
@@ -2,11 +2,9 @@
 
 import flup.server.fcgi
 
-def main (app, bind=None) :
-    """
-        Run as a non-threaded single-process non-multiplexed FastCGI server
-    """
+import memcache
 
+def run_fastcgi (app, bind=None) :
     # create WSGIServer
     server = flup.server.fcgi.WSGIServer(app, 
         # try to supress threading
@@ -27,8 +25,22 @@
     # 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(pngtile.wsgi.application)
+    main()