I have followed a few different guides on how to deploy a Flask app to IIS on Windows Server 2008R2 but primarily this one http://netdot.co/2015/03/09/flask-on-iis/. There is probably some small detail that I have missed that I hope you can help me with. When navigating to localhost/PythonTest a get the following 404 Not Found error message: "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again."
This is the folder structure of the Flask app
- webapps\PythonTest
- app.py
- web.config
- wfastcgi.py
app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello from FastCGI via IIS!"
if __name__ == "__main__":
app.run()
web.config
<configuration>
<system.webServer>
<handlers>
<add name="PythonTestHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\PythonEnvironments\Python36\python.exe|C:\webapps\PythonTest\wfastcgi.py" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
wfastcgi.py - copy/pasted from installed directory after running
pip install wfastcgi
In IIS I have created a new website called PythonTest and mapped it to the webapps\PythonTest folder. I have installed wFastCGI in IIS using the web platform installer. In the created website I have added a handler mapping called PythonTestHandler with:
Request path = *
Module = FastCgiModule
Executable (optional) = C:\PythonEnvironments\Python36\python.exe|C:\webapps\PythonTest\wfastcgi.py
I also made sure that the checkbox in Request restrictions is unchecked.
In the FastCgiSetting for the web server there is one entry that is created after the handler is added in the step above. Full path points to python.exe and arguments to the wfastcgi.py file as defined above. I have added two environment variables, one called PYTHONPATH pointing the python.exe file and one called WSGI_HANDLER with the value app.app.
Any suggestions on how to find the problem would be very welcome.
EDIT 1
I have given IUSR, IIS_IUSR, LOCAL SERVICE and NETWORK SERVICE read, exceute and list access to both the webapps\PythonTest folder and the PythonEnvironments\Python36 folder.