How To Add Directory To Path In Azure Python App Service
I have a python azure app running fine. I have installed cmake in it using python -m pip install cmake This was installed fine but I also got the below warning: WARNING: The scrip
Solution 1:
There is an official tutorial:How to set up a Python environment on Azure App Service.
Configure the HttpPlatform handler
<?xml version="1.0" encoding="utf-8"?><configuration><system.webServer><handlers><addname="PythonHandler"path="*"verb="*"modules="httpPlatformHandler"resourceType="Unspecified"/></handlers><httpPlatformprocessPath="D:\home\Python361x64\python.exe"arguments="D:\home\site\wwwroot\runserver.py --port %HTTP_PLATFORM_PORT%"stdoutLogEnabled="true"stdoutLogFile="D:\home\LogFiles\python.log"startupTimeLimit="60"processesPerApplication="16"><environmentVariables><environmentVariablename="SERVER_PORT"value="%HTTP_PLATFORM_PORT%" /></environmentVariables></httpPlatform></system.webServer></configuration>
Configure the FastCGI handler
<?xml version="1.0" encoding="utf-8"?><configuration><appSettings><addkey="PYTHONPATH"value="D:\home\site\wwwroot"/><!-- The handler here is specific to Bottle; other frameworks vary. --><addkey="WSGI_HANDLER"value="app.wsgi_app()"/><addkey="WSGI_LOG"value="D:\home\LogFiles\wfastcgi.log"/></appSettings><system.webServer><handlers><addname="PythonHandler"path="*"verb="*"modules="FastCgiModule"scriptProcessor="D:\home\Python361x64\python.exe|D:\home\Python361x64\wfastcgi.py"resourceType="Unspecified"requireAccess="Script"/></handlers></system.webServer></configuration>
Here is a FastCGI handler sample with application setting.
And there is another way with applicationHost.xdt
file, you could refer to here:Xdt transform samples. To add a folder to PATH, below is a sample.
<?xml version="1.0"?><configurationxmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><system.webServer><runtimexdt:Transform="InsertIfMissing"><environmentVariablesxdt:Transform="InsertIfMissing"><addname="FOO"value="BAR"xdt:Locator="Match(name)"xdt:Transform="InsertIfMissing" /><addname="PATH"value="%PATH%;%HOME%\FolderOnPath"xdt:Locator="Match(name)"xdt:Transform="InsertIfMissing" /></environmentVariables></runtime></system.webServer></configuration>
Post a Comment for "How To Add Directory To Path In Azure Python App Service"