New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

wfastcgi

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wfastcgi - pypi Package Compare versions

Comparing version
2.2
to
2.2.1
+218
PKG-INFO
Metadata-Version: 1.1
Name: wfastcgi
Version: 2.2.1
Summary: An IIS-Python bridge based on WSGI and FastCGI.
Home-page: http://aka.ms/PTVS
Author: Microsoft Corporation
Author-email: ptvshelp@microsoft.com
License: Apache License 2.0
Description: WFastCGI
========
wfastcgi.py provides a bridge between `IIS <http://www.iis.net/>`__ and Python
using WSGI and FastCGI, similar to what ``mod_python`` provides for Apache HTTP
Server.
It can be used with any Python web application or framework that supports WSGI,
and provides an efficient way to handle requests and process pools through IIS.
Installation
============
Downloading Package
-------------------
To install via the Python Package Index (PyPI), type:
.. code:: shell
pip install wfastcgi
Installing IIS and FastCGI
--------------------------
See the `IIS Installation <http://www.iis.net/learn/install>`__ page for
information about installing IIS on your version of Windows.
The Application Development/CGI package is required for use with `wfastcgi`.
Enabling wfastcgi
-----------------
Once ``wfastcgi`` and IIS are installed, run ``wfastcgi-enable`` as an
administrator to enable ``wfastcgi`` in the IIS configuration. This will
configure a CGI application that can then be specified as a
`route handler <#route-handlers>`__.
.. code:: shell
wfastcgi-enable
To disable ``wfastcgi`` before uninstalling, run ``wfastcgi-disable``.
.. code:: shell
wfastcgi-disable
pip uninstall wfastcgi
**Note**: uninstalling ``wfastcgi`` does not automatically unregister the CGI
application.
If the first argument passed to ``wfastcgi-enable`` or ``wfastcgi-disable`` is
a valid file, the entire command line is used to register or unregister the CGI
handler.
For example, the following command will enable wfastcgi with IIS Express and a
specific host configuration:
.. code:: shell
wfastcgi-enable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
You can disable wfastcgi in the same configuration file using
``wfastcgi-disable`` with the same options:
.. code:: shell
wfastcgi-disable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
.. route-handlers
Route Handlers
==============
Routing requests to your Python application requires some site-local
configuration. In your site's ``web.config`` file, you will need to add a
handler and some app settings:
.. code:: xml
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python34\python.exe|C:\Python34\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
<add key="PYTHONPATH" value="C:\MyApp" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\Logs\my_app.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
<add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />
<add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />
</appSettings>
</configuration>
The value for ``scriptProcessor`` is displayed in the output of
``wfastcgi-enable`` and may vary from machine to machine. The values for
``path`` and ``verb`` may also be customized to further restrict the requests
for which this handler will be used.
The ``name`` value may be used in nested ``web.config`` files to exclude this
handler. For example, adding a ``web.config`` to your ``static/`` subdirectory
containing ``<remove name="Python FastCGI" />`` will prevent IIS from serving
static files through your Python app.
The provided app settings are translated into environment variables and can be
accessed from your Python application using ``os.getenv``. The following
variables are used by ``wfastcgi``.
WSGI_HANDLER
------------
This is a Python name that evaluates to the WSGI application object. It is a
series of dotted names that are optionally called with no parameters. When
resolving the handler, the following steps are used:
1. As many names as possible are loaded using ``import``. The last name is
never imported.
2. Once a module has been obtained, each remaining name is retrieved as an
attribute. If ``()`` follows the name, it is called before getting the
following name.
Errors while resolving the name are returned as a simple 500 error page.
Depending on your IIS configuration, you may only receive this page when
accessing the site from the same machine.
PYTHONPATH
----------
Python is already running when this setting is converted into an environment
variable, so ``wfastcgi`` performs extra processing to expand environment
variables in its value (including those added from app settings) and to expand
``sys.path``.
If you are running an implementation of Python that uses a variable named
something other than ``PYTHONPATH``, you should still specify this value as
``PYTHONPATH``.
WSGI_LOG
--------
This is a full path to a writable file where logging information is written.
This logging is not highly efficient, and it is recommended that this setting
only be specified for debugging purposes.
WSGI_RESTART_FILE_REGEX
-----------------------
The regular expression used to identify when changed files belong to your
website. If a file belonging to your site changes, all active CGI processes
will be terminated so that the new files can be loaded.
By default, all ``*.py`` and ``*.config`` files are included. Specify an empty
string to disable auto-restart.
APPINSIGHTS_INSTRUMENTATIONKEY
------------------------------
Providing an instrumentation key with this value will enable request tracing
with `Application Insights <http://pypi.python.org/pypi/applicationinsights>`__
for your entire site. If you have not installed the ``applicationinsights``
package, a warning is written to ``WSGI_LOG`` (if enabled) but the site will
operate normally.
Application Insights is a low-overhead monitoring system for tracking your
application's health and performance. When enabled, all errors in your site
will be reported through Application Insights.
DJANGO_SETTINGS_MODULE
----------------------
A commonly used registry key when deploying sites built using Django. Typically
Django sites will set ``WSGI_HANDLER`` to
``django.core.handlers.wsgi.WSGIHandler()`` and load app-specific settings
through the module specified by this value.
Sites using frameworks other than Django do not need to specify this value.
Keywords: iis fastcgi wsgi windows server mod_python
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Server
WFastCGI
========
wfastcgi.py provides a bridge between `IIS <http://www.iis.net/>`__ and Python
using WSGI and FastCGI, similar to what ``mod_python`` provides for Apache HTTP
Server.
It can be used with any Python web application or framework that supports WSGI,
and provides an efficient way to handle requests and process pools through IIS.
Installation
============
Downloading Package
-------------------
To install via the Python Package Index (PyPI), type:
.. code:: shell
pip install wfastcgi
Installing IIS and FastCGI
--------------------------
See the `IIS Installation <http://www.iis.net/learn/install>`__ page for
information about installing IIS on your version of Windows.
The Application Development/CGI package is required for use with `wfastcgi`.
Enabling wfastcgi
-----------------
Once ``wfastcgi`` and IIS are installed, run ``wfastcgi-enable`` as an
administrator to enable ``wfastcgi`` in the IIS configuration. This will
configure a CGI application that can then be specified as a
`route handler <#route-handlers>`__.
.. code:: shell
wfastcgi-enable
To disable ``wfastcgi`` before uninstalling, run ``wfastcgi-disable``.
.. code:: shell
wfastcgi-disable
pip uninstall wfastcgi
**Note**: uninstalling ``wfastcgi`` does not automatically unregister the CGI
application.
If the first argument passed to ``wfastcgi-enable`` or ``wfastcgi-disable`` is
a valid file, the entire command line is used to register or unregister the CGI
handler.
For example, the following command will enable wfastcgi with IIS Express and a
specific host configuration:
.. code:: shell
wfastcgi-enable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
You can disable wfastcgi in the same configuration file using
``wfastcgi-disable`` with the same options:
.. code:: shell
wfastcgi-disable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
.. route-handlers
Route Handlers
==============
Routing requests to your Python application requires some site-local
configuration. In your site's ``web.config`` file, you will need to add a
handler and some app settings:
.. code:: xml
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python34\python.exe|C:\Python34\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
<add key="PYTHONPATH" value="C:\MyApp" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\Logs\my_app.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
<add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />
<add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />
</appSettings>
</configuration>
The value for ``scriptProcessor`` is displayed in the output of
``wfastcgi-enable`` and may vary from machine to machine. The values for
``path`` and ``verb`` may also be customized to further restrict the requests
for which this handler will be used.
The ``name`` value may be used in nested ``web.config`` files to exclude this
handler. For example, adding a ``web.config`` to your ``static/`` subdirectory
containing ``<remove name="Python FastCGI" />`` will prevent IIS from serving
static files through your Python app.
The provided app settings are translated into environment variables and can be
accessed from your Python application using ``os.getenv``. The following
variables are used by ``wfastcgi``.
WSGI_HANDLER
------------
This is a Python name that evaluates to the WSGI application object. It is a
series of dotted names that are optionally called with no parameters. When
resolving the handler, the following steps are used:
1. As many names as possible are loaded using ``import``. The last name is
never imported.
2. Once a module has been obtained, each remaining name is retrieved as an
attribute. If ``()`` follows the name, it is called before getting the
following name.
Errors while resolving the name are returned as a simple 500 error page.
Depending on your IIS configuration, you may only receive this page when
accessing the site from the same machine.
PYTHONPATH
----------
Python is already running when this setting is converted into an environment
variable, so ``wfastcgi`` performs extra processing to expand environment
variables in its value (including those added from app settings) and to expand
``sys.path``.
If you are running an implementation of Python that uses a variable named
something other than ``PYTHONPATH``, you should still specify this value as
``PYTHONPATH``.
WSGI_LOG
--------
This is a full path to a writable file where logging information is written.
This logging is not highly efficient, and it is recommended that this setting
only be specified for debugging purposes.
WSGI_RESTART_FILE_REGEX
-----------------------
The regular expression used to identify when changed files belong to your
website. If a file belonging to your site changes, all active CGI processes
will be terminated so that the new files can be loaded.
By default, all ``*.py`` and ``*.config`` files are included. Specify an empty
string to disable auto-restart.
APPINSIGHTS_INSTRUMENTATIONKEY
------------------------------
Providing an instrumentation key with this value will enable request tracing
with `Application Insights <http://pypi.python.org/pypi/applicationinsights>`__
for your entire site. If you have not installed the ``applicationinsights``
package, a warning is written to ``WSGI_LOG`` (if enabled) but the site will
operate normally.
Application Insights is a low-overhead monitoring system for tracking your
application's health and performance. When enabled, all errors in your site
will be reported through Application Insights.
DJANGO_SETTINGS_MODULE
----------------------
A commonly used registry key when deploying sites built using Django. Typically
Django sites will set ``WSGI_HANDLER`` to
``django.core.handlers.wsgi.WSGIHandler()`` and load app-specific settings
through the module specified by this value.
Sites using frameworks other than Django do not need to specify this value.
[wheel]
universal = True
[sdist]
formats = gztar
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
from setuptools import setup
from os.path import join, split
with open(join(split(__file__)[0], 'README.rst')) as f:
long_description = f.read()
setup(
name='wfastcgi',
version='2.2.1',
description='An IIS-Python bridge based on WSGI and FastCGI.',
long_description=long_description,
url='http://aka.ms/PTVS',
# Author details
author='Microsoft Corporation',
author_email='ptvshelp@microsoft.com',
license='Apache License 2.0',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 6 - Mature',
'License :: OSI Approved :: Apache Software License',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Topic :: Internet',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Server',
],
keywords='iis fastcgi wsgi windows server mod_python',
py_modules=['wfastcgi'],
install_requires=[],
entry_points={
'console_scripts': [
'wfastcgi = wfastcgi:main',
'wfastcgi-enable = wfastcgi:enable',
'wfastcgi-disable = wfastcgi:disable',
]
},
)
[console_scripts]
wfastcgi = wfastcgi:main
wfastcgi-disable = wfastcgi:disable
wfastcgi-enable = wfastcgi:enable
Metadata-Version: 1.1
Name: wfastcgi
Version: 2.2.1
Summary: An IIS-Python bridge based on WSGI and FastCGI.
Home-page: http://aka.ms/PTVS
Author: Microsoft Corporation
Author-email: ptvshelp@microsoft.com
License: Apache License 2.0
Description: WFastCGI
========
wfastcgi.py provides a bridge between `IIS <http://www.iis.net/>`__ and Python
using WSGI and FastCGI, similar to what ``mod_python`` provides for Apache HTTP
Server.
It can be used with any Python web application or framework that supports WSGI,
and provides an efficient way to handle requests and process pools through IIS.
Installation
============
Downloading Package
-------------------
To install via the Python Package Index (PyPI), type:
.. code:: shell
pip install wfastcgi
Installing IIS and FastCGI
--------------------------
See the `IIS Installation <http://www.iis.net/learn/install>`__ page for
information about installing IIS on your version of Windows.
The Application Development/CGI package is required for use with `wfastcgi`.
Enabling wfastcgi
-----------------
Once ``wfastcgi`` and IIS are installed, run ``wfastcgi-enable`` as an
administrator to enable ``wfastcgi`` in the IIS configuration. This will
configure a CGI application that can then be specified as a
`route handler <#route-handlers>`__.
.. code:: shell
wfastcgi-enable
To disable ``wfastcgi`` before uninstalling, run ``wfastcgi-disable``.
.. code:: shell
wfastcgi-disable
pip uninstall wfastcgi
**Note**: uninstalling ``wfastcgi`` does not automatically unregister the CGI
application.
If the first argument passed to ``wfastcgi-enable`` or ``wfastcgi-disable`` is
a valid file, the entire command line is used to register or unregister the CGI
handler.
For example, the following command will enable wfastcgi with IIS Express and a
specific host configuration:
.. code:: shell
wfastcgi-enable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
You can disable wfastcgi in the same configuration file using
``wfastcgi-disable`` with the same options:
.. code:: shell
wfastcgi-disable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
.. route-handlers
Route Handlers
==============
Routing requests to your Python application requires some site-local
configuration. In your site's ``web.config`` file, you will need to add a
handler and some app settings:
.. code:: xml
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python34\python.exe|C:\Python34\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
<add key="PYTHONPATH" value="C:\MyApp" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\Logs\my_app.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
<add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />
<add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />
</appSettings>
</configuration>
The value for ``scriptProcessor`` is displayed in the output of
``wfastcgi-enable`` and may vary from machine to machine. The values for
``path`` and ``verb`` may also be customized to further restrict the requests
for which this handler will be used.
The ``name`` value may be used in nested ``web.config`` files to exclude this
handler. For example, adding a ``web.config`` to your ``static/`` subdirectory
containing ``<remove name="Python FastCGI" />`` will prevent IIS from serving
static files through your Python app.
The provided app settings are translated into environment variables and can be
accessed from your Python application using ``os.getenv``. The following
variables are used by ``wfastcgi``.
WSGI_HANDLER
------------
This is a Python name that evaluates to the WSGI application object. It is a
series of dotted names that are optionally called with no parameters. When
resolving the handler, the following steps are used:
1. As many names as possible are loaded using ``import``. The last name is
never imported.
2. Once a module has been obtained, each remaining name is retrieved as an
attribute. If ``()`` follows the name, it is called before getting the
following name.
Errors while resolving the name are returned as a simple 500 error page.
Depending on your IIS configuration, you may only receive this page when
accessing the site from the same machine.
PYTHONPATH
----------
Python is already running when this setting is converted into an environment
variable, so ``wfastcgi`` performs extra processing to expand environment
variables in its value (including those added from app settings) and to expand
``sys.path``.
If you are running an implementation of Python that uses a variable named
something other than ``PYTHONPATH``, you should still specify this value as
``PYTHONPATH``.
WSGI_LOG
--------
This is a full path to a writable file where logging information is written.
This logging is not highly efficient, and it is recommended that this setting
only be specified for debugging purposes.
WSGI_RESTART_FILE_REGEX
-----------------------
The regular expression used to identify when changed files belong to your
website. If a file belonging to your site changes, all active CGI processes
will be terminated so that the new files can be loaded.
By default, all ``*.py`` and ``*.config`` files are included. Specify an empty
string to disable auto-restart.
APPINSIGHTS_INSTRUMENTATIONKEY
------------------------------
Providing an instrumentation key with this value will enable request tracing
with `Application Insights <http://pypi.python.org/pypi/applicationinsights>`__
for your entire site. If you have not installed the ``applicationinsights``
package, a warning is written to ``WSGI_LOG`` (if enabled) but the site will
operate normally.
Application Insights is a low-overhead monitoring system for tracking your
application's health and performance. When enabled, all errors in your site
will be reported through Application Insights.
DJANGO_SETTINGS_MODULE
----------------------
A commonly used registry key when deploying sites built using Django. Typically
Django sites will set ``WSGI_HANDLER`` to
``django.core.handlers.wsgi.WSGIHandler()`` and load app-specific settings
through the module specified by this value.
Sites using frameworks other than Django do not need to specify this value.
Keywords: iis fastcgi wsgi windows server mod_python
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Server
README.rst
setup.cfg
setup.py
wfastcgi.py
wfastcgi.egg-info/PKG-INFO
wfastcgi.egg-info/SOURCES.txt
wfastcgi.egg-info/dependency_links.txt
wfastcgi.egg-info/entry_points.txt
wfastcgi.egg-info/top_level.txt
+46
-23

@@ -1,16 +0,21 @@

# ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution. If
# you cannot locate the Apache License, Version 2.0, please send an email to
# vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
# by the terms of the Apache License, Version 2.0.
#
# You must not remove this notice, or any other, from this software.
#
# ###########################################################################
# Python Tools for Visual Studio
# Copyright(c) Microsoft Corporation
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the License); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
# IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
# MERCHANTABLITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
from __future__ import absolute_import, print_function, with_statement
from __future__ import absolute_import, print_function, with_statement
__author__ = "Microsoft Corporation <ptvshelp@microsoft.com>"
__version__ = "3.0.0.0"
import ctypes

@@ -35,3 +40,3 @@ import datetime

__version__ = '2.2.0'
__version__ = '3.0.0'

@@ -339,4 +344,12 @@ if sys.version_info[0] == 3:

APPINSIGHT_CLIENT = None
def log(txt):
"""Logs messages to a log file if WSGI_LOG env var is defined."""
if APPINSIGHT_CLIENT:
try:
APPINSIGHT_CLIENT.track_event(txt)
except:
pass
log_file = os.environ.get('WSGI_LOG')

@@ -612,2 +625,3 @@ if log_file:

def read_wsgi_handler(physical_path):
global APPINSIGHT_CLIENT
env = get_environment(physical_path)

@@ -624,7 +638,7 @@ os.environ.update(env)

handler = get_wsgi_handler(os.getenv('WSGI_HANDLER'))
instr_key = env.get("APPINSIGHTS_INSTRUMENTATIONKEY")
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
instr_key = os.getenv("APPINSIGHTS_INSTRUMENTATIONKEY")
if instr_key:
try:
# Attempt the import after updating sys.path- sites must
# Attempt the import after updating sys.path - sites must
# include applicationinsights themselves.

@@ -634,5 +648,5 @@ from applicationinsights.requests import WSGIApplication

maybe_log("Failed to import applicationinsights: " + traceback.format_exc())
pass
else:
handler = WSGIApplication(instr_key, handler)
APPINSIGHT_CLIENT = handler.client
# Ensure we will flush any remaining events when we exit

@@ -806,2 +820,9 @@ on_exit(handler.client.flush)

# correct SCRIPT_NAME and PATH_INFO if we are told what our SCRIPT_NAME should be
if 'SCRIPT_NAME' in os.environ and record.params['PATH_INFO'].lower().startswith(os.environ['SCRIPT_NAME'].lower()):
record.params['SCRIPT_NAME'] = os.environ['SCRIPT_NAME']
record.params['PATH_INFO'] = record.params['PATH_INFO'][len(record.params['SCRIPT_NAME']):]
record.params['wsgi.script_name'] = wsgi_encode(record.params['SCRIPT_NAME'])
record.params['wsgi.path_info'] = wsgi_encode(record.params['PATH_INFO'])
# Send each part of the response to FCGI_STDOUT.

@@ -854,19 +875,21 @@ # Exceptions raised in the handler will be logged by the context

def enable():
quoted_file = '"' + __file__ + '"' if ' ' in __file__ else __file__
res = _run_appcmd([
"set", "config", "/section:system.webServer/fastCGI",
"/+[fullPath='" + sys.executable + "', arguments='" + __file__ + "', signalBeforeTerminateSeconds='30']"
"/+[fullPath='" + sys.executable + "', arguments='" + quoted_file + "', signalBeforeTerminateSeconds='30']"
])
if res == 0:
print('"%s|%s" can now be used as a FastCGI script processor' % (sys.executable, __file__))
print('"%s|%s" can now be used as a FastCGI script processor' % (sys.executable, quoted_file))
return res
def disable():
quoted_file = '"' + __file__ + '"' if ' ' in __file__ else __file__
res = _run_appcmd([
"set", "config", "/section:system.webServer/fastCGI",
"/-[fullPath='" + sys.executable + "', arguments='" + __file__ + "', signalBeforeTerminateSeconds='30']"
"/-[fullPath='" + sys.executable + "', arguments='" + quoted_file + "', signalBeforeTerminateSeconds='30']"
])
if res == 0:
print('"%s|%s" is no longer registered for use with FastCGI' % (sys.executable, __file__))
print('"%s|%s" is no longer registered for use with FastCGI' % (sys.executable, quoted_file))
return res

@@ -873,0 +896,0 @@

WFastCGI
========
wfastcgi.py provides a bridge between `IIS <http://www.iis.net/>`__ and Python
using WSGI and FastCGI, similar to what ``mod_python`` provides for Apache HTTP
Server.
It can be used with any Python web application or framework that supports WSGI,
and provides an efficient way to handle requests and process pools through IIS.
Installation
============
Downloading Package
-------------------
To install via the Python Package Index (PyPI), type:
.. code:: shell
pip install wfastcgi
Installing IIS and FastCGI
--------------------------
See the `IIS Installation <http://www.iis.net/learn/install>`__ page for
information about installing IIS on your version of Windows.
The Application Development/CGI package is required for use with `wfastcgi`.
Enabling wfastcgi
-----------------
Once ``wfastcgi`` and IIS are installed, run ``wfastcgi-enable`` as an
administrator to enable ``wfastcgi`` in the IIS configuration. This will
configure a CGI application that can then be specified as a
`route handler <#route-handlers>`__.
.. code:: shell
wfastcgi-enable
To disable ``wfastcgi`` before uninstalling, run ``wfastcgi-disable``.
.. code:: shell
wfastcgi-disable
pip uninstall wfastcgi
**Note**: uninstalling ``wfastcgi`` does not automatically unregister the CGI
application.
If the first argument passed to ``wfastcgi-enable`` or ``wfastcgi-disable`` is
a valid file, the entire command line is used to register or unregister the CGI
handler.
For example, the following command will enable wfastcgi with IIS Express and a
specific host configuration:
.. code:: shell
wfastcgi-enable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
You can disable wfastcgi in the same configuration file using
``wfastcgi-disable`` with the same options:
.. code:: shell
wfastcgi-disable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
.. route-handlers
Route Handlers
==============
Routing requests to your Python application requires some site-local
configuration. In your site's ``web.config`` file, you will need to add a
handler and some app settings:
.. code:: xml
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python34\python.exe|C:\Python34\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
<add key="PYTHONPATH" value="C:\MyApp" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\Logs\my_app.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
<add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />
<add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />
</appSettings>
</configuration>
The value for ``scriptProcessor`` is displayed in the output of
``wfastcgi-enable`` and may vary from machine to machine. The values for
``path`` and ``verb`` may also be customized to further restrict the requests
for which this handler will be used.
The ``name`` value may be used in nested ``web.config`` files to exclude this
handler. For example, adding a ``web.config`` to your ``static/`` subdirectory
containing ``<remove name="Python FastCGI" />`` will prevent IIS from serving
static files through your Python app.
The provided app settings are translated into environment variables and can be
accessed from your Python application using ``os.getenv``. The following
variables are used by ``wfastcgi``.
WSGI_HANDLER
------------
This is a Python name that evaluates to the WSGI application object. It is a
series of dotted names that are optionally called with no parameters. When
resolving the handler, the following steps are used:
1. As many names as possible are loaded using ``import``. The last name is
never imported.
2. Once a module has been obtained, each remaining name is retrieved as an
attribute. If ``()`` follows the name, it is called before getting the
following name.
Errors while resolving the name are returned as a simple 500 error page.
Depending on your IIS configuration, you may only receive this page when
accessing the site from the same machine.
PYTHONPATH
----------
Python is already running when this setting is converted into an environment
variable, so ``wfastcgi`` performs extra processing to expand environment
variables in its value (including those added from app settings) and to expand
``sys.path``.
If you are running an implementation of Python that uses a variable named
something other than ``PYTHONPATH``, you should still specify this value as
``PYTHONPATH``.
WSGI_LOG
--------
This is a full path to a writable file where logging information is written.
This logging is not highly efficient, and it is recommended that this setting
only be specified for debugging purposes.
WSGI_RESTART_FILE_REGEX
-----------------------
The regular expression used to identify when changed files belong to your
website. If a file belonging to your site changes, all active CGI processes
will be terminated so that the new files can be loaded.
By default, all ``*.py`` and ``*.config`` files are included. Specify an empty
string to disable auto-restart.
APPINSIGHTS_INSTRUMENTATIONKEY
------------------------------
Providing an instrumentation key with this value will enable request tracing
with `Application Insights <http://pypi.python.org/pypi/applicationinsights>`__
for your entire site. If you have not installed the ``applicationinsights``
package, a warning is written to ``WSGI_LOG`` (if enabled) but the site will
operate normally.
Application Insights is a low-overhead monitoring system for tracking your
application's health and performance. When enabled, all errors in your site
will be reported through Application Insights.
DJANGO_SETTINGS_MODULE
----------------------
A commonly used registry key when deploying sites built using Django. Typically
Django sites will set ``WSGI_HANDLER`` to
``django.core.handlers.wsgi.WSGIHandler()`` and load app-specific settings
through the module specified by this value.
Sites using frameworks other than Django do not need to specify this value.
[console_scripts]
wfastcgi = wfastcgi:main
wfastcgi-disable = wfastcgi:disable
wfastcgi-enable = wfastcgi:enable
Metadata-Version: 2.0
Name: wfastcgi
Version: 2.2
Summary: An IIS-Python bridge based on WSGI and FastCGI.
Home-page: http://aka.ms/PTVS
Author: Microsoft Corporation
Author-email: ptvshelp@microsoft.com
License: Apache License 2.0
Keywords: iis fastcgi wsgi windows server mod_python
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Server
WFastCGI
========
wfastcgi.py provides a bridge between `IIS <http://www.iis.net/>`__ and Python
using WSGI and FastCGI, similar to what ``mod_python`` provides for Apache HTTP
Server.
It can be used with any Python web application or framework that supports WSGI,
and provides an efficient way to handle requests and process pools through IIS.
Installation
============
Downloading Package
-------------------
To install via the Python Package Index (PyPI), type:
.. code:: shell
pip install wfastcgi
Installing IIS and FastCGI
--------------------------
See the `IIS Installation <http://www.iis.net/learn/install>`__ page for
information about installing IIS on your version of Windows.
The Application Development/CGI package is required for use with `wfastcgi`.
Enabling wfastcgi
-----------------
Once ``wfastcgi`` and IIS are installed, run ``wfastcgi-enable`` as an
administrator to enable ``wfastcgi`` in the IIS configuration. This will
configure a CGI application that can then be specified as a
`route handler <#route-handlers>`__.
.. code:: shell
wfastcgi-enable
To disable ``wfastcgi`` before uninstalling, run ``wfastcgi-disable``.
.. code:: shell
wfastcgi-disable
pip uninstall wfastcgi
**Note**: uninstalling ``wfastcgi`` does not automatically unregister the CGI
application.
If the first argument passed to ``wfastcgi-enable`` or ``wfastcgi-disable`` is
a valid file, the entire command line is used to register or unregister the CGI
handler.
For example, the following command will enable wfastcgi with IIS Express and a
specific host configuration:
.. code:: shell
wfastcgi-enable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
You can disable wfastcgi in the same configuration file using
``wfastcgi-disable`` with the same options:
.. code:: shell
wfastcgi-disable "C:\Program Files (x86)\IIS Express\appcmd.exe"
/apphostconfig:C:\Path\To\applicationhost.config
.. route-handlers
Route Handlers
==============
Routing requests to your Python application requires some site-local
configuration. In your site's ``web.config`` file, you will need to add a
handler and some app settings:
.. code:: xml
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python34\python.exe|C:\Python34\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
<add key="PYTHONPATH" value="C:\MyApp" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\Logs\my_app.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
<add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />
<add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />
</appSettings>
</configuration>
The value for ``scriptProcessor`` is displayed in the output of
``wfastcgi-enable`` and may vary from machine to machine. The values for
``path`` and ``verb`` may also be customized to further restrict the requests
for which this handler will be used.
The ``name`` value may be used in nested ``web.config`` files to exclude this
handler. For example, adding a ``web.config`` to your ``static/`` subdirectory
containing ``<remove name="Python FastCGI" />`` will prevent IIS from serving
static files through your Python app.
The provided app settings are translated into environment variables and can be
accessed from your Python application using ``os.getenv``. The following
variables are used by ``wfastcgi``.
WSGI_HANDLER
------------
This is a Python name that evaluates to the WSGI application object. It is a
series of dotted names that are optionally called with no parameters. When
resolving the handler, the following steps are used:
1. As many names as possible are loaded using ``import``. The last name is
never imported.
2. Once a module has been obtained, each remaining name is retrieved as an
attribute. If ``()`` follows the name, it is called before getting the
following name.
Errors while resolving the name are returned as a simple 500 error page.
Depending on your IIS configuration, you may only receive this page when
accessing the site from the same machine.
PYTHONPATH
----------
Python is already running when this setting is converted into an environment
variable, so ``wfastcgi`` performs extra processing to expand environment
variables in its value (including those added from app settings) and to expand
``sys.path``.
If you are running an implementation of Python that uses a variable named
something other than ``PYTHONPATH``, you should still specify this value as
``PYTHONPATH``.
WSGI_LOG
--------
This is a full path to a writable file where logging information is written.
This logging is not highly efficient, and it is recommended that this setting
only be specified for debugging purposes.
WSGI_RESTART_FILE_REGEX
-----------------------
The regular expression used to identify when changed files belong to your
website. If a file belonging to your site changes, all active CGI processes
will be terminated so that the new files can be loaded.
By default, all ``*.py`` and ``*.config`` files are included. Specify an empty
string to disable auto-restart.
APPINSIGHTS_INSTRUMENTATIONKEY
------------------------------
Providing an instrumentation key with this value will enable request tracing
with `Application Insights <http://pypi.python.org/pypi/applicationinsights>`__
for your entire site. If you have not installed the ``applicationinsights``
package, a warning is written to ``WSGI_LOG`` (if enabled) but the site will
operate normally.
Application Insights is a low-overhead monitoring system for tracking your
application's health and performance. When enabled, all errors in your site
will be reported through Application Insights.
DJANGO_SETTINGS_MODULE
----------------------
A commonly used registry key when deploying sites built using Django. Typically
Django sites will set ``WSGI_HANDLER`` to
``django.core.handlers.wsgi.WSGIHandler()`` and load app-specific settings
through the module specified by this value.
Sites using frameworks other than Django do not need to specify this value.
{"extensions": {"python.exports": {"console_scripts": {"wfastcgi-enable": "wfastcgi:enable", "wfastcgi": "wfastcgi:main", "wfastcgi-disable": "wfastcgi:disable"}}, "python.commands": {"wrap_console": {"wfastcgi-enable": "wfastcgi:enable", "wfastcgi": "wfastcgi:main", "wfastcgi-disable": "wfastcgi:disable"}}, "python.details": {"document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "http://aka.ms/PTVS"}, "contacts": [{"role": "author", "name": "Microsoft Corporation", "email": "ptvshelp@microsoft.com"}]}}, "license": "Apache License 2.0", "generator": "bdist_wheel (0.24.0)", "summary": "An IIS-Python bridge based on WSGI and FastCGI.", "version": "2.2", "name": "wfastcgi", "classifiers": ["Development Status :: 6 - Mature", "License :: OSI Approved :: Apache Software License", "Operating System :: Microsoft :: Windows", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI :: Server"], "metadata_version": "2.0", "keywords": ["iis", "fastcgi", "wsgi", "windows", "server", "mod_python"]}
wfastcgi.py,sha256=zrja4J3oe_1D4gDUylJoG_A4tztngc5NbitXAwDdtwQ,30927
wfastcgi-2.2.dist-info/DESCRIPTION.rst,sha256=Tf2jBXrABNxXbJ3yqUd4tsUJ12ca5sTE_Txf0ElLw4s,6574
wfastcgi-2.2.dist-info/entry_points.txt,sha256=4RPIJtoHD67xysN09gRLrV13Ha0ibAoywGDWlcf14qw,114
wfastcgi-2.2.dist-info/METADATA,sha256=tjygt4ko_b5degrTCz02_x8p6SJ-hwFO9cB_FzEe-LU,7467
wfastcgi-2.2.dist-info/metadata.json,sha256=GSKfOxuL_Q391xToIQPMp-iSmPmglmteBaaOlFWqf08,1304
wfastcgi-2.2.dist-info/RECORD,,
wfastcgi-2.2.dist-info/top_level.txt,sha256=1gxQEcsYytUDpUFYzpwdDh-9COVHplbP374xp0cVW2o,9
wfastcgi-2.2.dist-info/WHEEL,sha256=56WjMPRUEpmb30QaTzVbQCpri5lzKGby5HLDkAMQeIU,116
wfastcgi
Wheel-Version: 1.0
Generator: bdist_wheel (0.24.0)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any