Repository navigation
wfastcgi
wfastcgi.py provides a gateway between IIS's FastCGI support to Python's WSGI protocol. It can be downloaded from our downloads section.
-
Download and install wfastcgi, it will install into C:\Python27\Scripts (or wherever your Python interpreter is installed).
-
Make sure IIS has FastCGI installed:
start /wait %windir%\System32\\PkgMgr.exe /iu:IIS-CGI -
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']"
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 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. |
- Documentation on docs.microsoft.com
- PTVS Project
- Development topics
- Additional resources
- wfastcgi (on PyPI)
- Video index; note that some videos are outdated.