My flask app is in D:\Applications\AccidentIdClassifier\flask_app.py
and contains a flask app called app
. I can run it fine on my local system.
I set up a Conda environment that I'd like to use for this app. I'm not sure how to get the web.config
file to reference the necessary conda environment. I started out just setting the WSGI_HANDLER
to flask_app.app
but I got an error about not being able to import a numpy dll which I believe is related to the venv not be activated.
I saw some discussion about using ptvs_virtualenv_proxy.handler
for the WSGI_HANDLER
value and to then use WSGI_ALT_VIRTUALENV_HANDLER
and WSGI_ALT_VIRTUALENV_ACTIVATE_THIS
but I don't know where to get a activate_this.py
and I'm not sure if I need to do anything to prime the pumps for ptvs_virtualenv_proxy.handler
Here's theweb.config
that I currently have (that isn't working)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="Python27_via_FastCGI" />
<remove name="Python34_via_FastCGI" />
<add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule"
scriptProcessor="C:\ProgramData\Anaconda3\python.exe|C:\ProgramData\Anaconda3\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.handler" />
<add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="c:\inetpub\pyroot\default\env\Scripts\activate_this.py" />
<add key="WSGI_ALT_VIRTUALENV_HANDLER" value="flask_app.app" />
<add key="PYTHONPATH" value="D:\Applications\AccidentIdClassifier" />
</appSettings>
<system.web>
<identity impersonate="false" />
</system.web>
</configuration>