11/13/2023 0 Comments Anaconda vs python for website hosting![]() WSGI_LOG is optional but recommended for debugging your app.WSGI_HANDLER must point to a WSGI app importable from your app.The value for PYTHONPATH may be freely extended but must include the root of your app.These values are available to your app as environment variables: Within the section of web.config, add keys for WSGI_HANDLER, WSGI_LOG (optional), and PYTHONPATH: Modify the PythonHandler entry in web.config so that the path matches the Python install location (see IIS Configuration Reference (iis.net) for exact details). ![]() The steps below assume that Python is installed in c:\python36-32 and that your app code is in c:\home\site\wwwroot adjust for your paths accordingly: Next, modify your app's web.config file to include the full paths to python.exe and wfastcgi.py in the PythonHandler key. To use FastCGI, first install and configure the wfastcgi package as described on /project/wfastcgi/. We recommend using HttpPlatform to configure your apps, as the WFastCGI project is no longer maintained. IIS receives incoming connections and forwards each request to a WSGI app running in one or more persistent Python processes. Configure the FastCGI handlerįastCGI is an interface that works at the request level. This example also shows how to create another environment variable, if desired, in this case SERVER_PORT. The HTTP_PLATFORM_PORT environment variable shown here contains the port that your local server should listen on for connections from localhost. You specify the script in the element of web.config, where the processPath attribute points to the site extension's Python interpreter and the arguments attribute points to your startup script that runs a local web server, in this case runserver.py, and any arguments you want to provide: This pass-through allows you to run any web server you like, but requires a startup script that runs a local web server, likely using a Python web framework such as Flask or Django. The HttpPlatform module passes socket connections directly to a standalone Python process. When using Visual Studio 2017 and later, you must modify web.config manually. Visual Studio versions 2015 and earlier make these modifications automatically. ![]() Your app's web.config file instructs the IIS (7+) web server running on Windows about how it should handle Python requests through either HttpPlatform (recommended) or FastCGI. Set web.config to point to the Python interpreter Accordingly, you can install all of your app's requirements into the global environment simply by running pip install -r requirements.txt at a command prompt. ![]() When using a dedicated host, you can use the global Python environment to run your app rather than a virtual environment. ![]() For convenience, you can add that location to your PATH environment variable. Record the location of the python.exe interpreter for later steps. To run a web app, first install your required version of Python directly on the Windows host machine as described on Install Python interpreters. The computer itself must also have Python installed along with any packages the web app requires. When using Internet Information Services (IIS) as a web server on a Windows computer (including Windows virtual machines on Azure), Python apps must include specific settings in their web.config files so that IIS can properly process Python code. Applies to: Visual Studio Visual Studio for Mac Visual Studio Code ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |