provides a gateway between IIS's FastCGI support to Python's WSGI protocol. It can be downloaded off of the releases page.

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\']"

Using in an application

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

        <add key="WSGI_HANDLER" value="django.core.handlers.wsgi.WSGIHandler()" />
        <add key="DJANGO_SETTINGS_MODULE" value="DjangoProject.settings" />   
            <add name="Python_FastCGI"
                requireAccess="Script" />
                <rule name="Django Application" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />

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


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.

Last edited Oct 1, 2014 at 4:41 PM by Zooba, version 9


No comments yet.