fastcgi_main.py
author Tero Marttila <terom@fixme.fi>
Mon, 16 Feb 2009 19:02:59 +0200
changeset 77 bef7196f7682
parent 68 d60e732f2109
permissions -rw-r--r--
add tree_parse test and fix treeparse to handle other than filesystem paths
#!/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,
    )
    
    # run... threads :(
    server.run()