Deploy Flask app for IIS 7.5 on Windows Server 2008R2 error - 404

I have looked at several different tutorials on how to deploy a Flask for IIS application on Windows Server 2008R2, but this is primarily http://netdot.co/2015/03/09/flask-on-iis/ , there are probably some minor details i missed, hope you can help me. When you go to localhost / PythonTest, you get the following 404 Not Found message : "The requested URL was not found on the server. If you entered the URL manually, please check the spelling and try again."

This is the folder structure of the Flask application

  • 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 / paste from installed directory after launch

pip install wfastcgi

      

In IIS, I created a new site called PythonTest and mapped it to the webapps \ PythonTest folder. I installed wFastCGI in IIS using the web platform installer. On the website I created, I 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 the Request Restrictions was not checked.

There is one entry in FastCgiSetting for the web server, which is created after adding the handler in the previous step. The full path points to python.exe and the arguments to the wfastcgi.py file as defined above. I added two environment variables, one called PYTHONPATH, which points to the python.exe file, and one called WSGI_HANDLER with the value app.app.

Any suggestions on how to find the problem would be greatly appreciated.

EDIT 1

I have provided IUSR, IIS_IUSR, LOCAL SERVICE and NETWORK SERVICE, read, exclude and list access to webapps \ PythonTest folder and PythonEnvironments \ Python36 folder.

+3


source to share





All Articles