FastCGI support using flup (ugh, threads)
authorTero Marttila <terom@fixme.fi>
Sat, 14 Feb 2009 19:22:59 +0200
changeset 67 4be5aebe0472
parent 66 d2ce81dd5e5d
child 68 d60e732f2109
FastCGI support using flup (ugh, threads)
fastcgi_main.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fastcgi_main.py	Sat Feb 14 19:22:59 2009 +0200
@@ -0,0 +1,39 @@
+#!/usr/bin/python2.5
+
+"""
+    WSGI FastCGI support using flup (grr, threads).
+
+    Currently, this uses flup.server.fcgi, but it attempts to batten down the hatches against the evil that is
+    *threads* :)
+"""
+
+import flup.server.fcgi
+
+def run (app, bind=None) :
+    """
+        Run as a non-threaded single-process non-multiplexed FastCGI server
+    """
+
+    # 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,
+    )
+    
+    import sys
+    sys.stderr.write("qmsk.web.fastcgi: run\n")
+
+    # run... threads :(
+    server.run()
+