Skip to content

wfastcgi

René Fleschenberg edited this page May 19, 2015 · 4 revisions

wfastcgi.py provides a gateway between IIS's FastCGI support to Python's WSGI protocol. It can be downloaded from our downloads section.

Installing & Configuring

  1. Download and install wfastcgi, it will install into C:\Python27\Scripts (or wherever your Python interpreter is installed).

  2. Make sure IIS has FastCGI installed:

    start /wait %windir%\System32\\PkgMgr.exe /iu:IIS-CGI

  3. Register the handler with IIS:

    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI "/+[fullPath='c:\Python27\python.exe', arguments='C:\Python27\Scripts\wfastcgi.py']"

Using in an application

You can now use the handler in a web.config file, here's an example configured for a Django project:


    
       


    
        
    
    
        
            
                
                
            
        
    

You can tweak the URL rewriting to include or exclude certain paths for serving static files or other requests from the same server.

Options

Options are specified with an appSetting in your top-level web.config file as WSGI_HANDLER is shown in the example above.

Option Name Description
WSGI_HANDLER Specifies the fully qualified handle name, such as "mymodule.handler" or "mymodule.package.handler". The module name will be imported and the specified handler name will be accessed. If the handler name ends in "()" the handler will be called with no arguments. If the handler cannot be fetched or is None wfastcgi will exit and log the error if WSGI_LOG is set.
WSGI_RESTART_FILE_REGEX Specifies the regex for the filenames which if modified will cause wfastcgi to exit and be restarted. Defaults to ".*((\.py)|(\.config))$".
WSGI_LOG Specifies the path to a log file of errors and important messages.

Clone this wiki locally