Deploying Python web app (Flask) in IIS using FastCGI get 500 Internal Server Error

1

I am trying to deploy Flask app in IIS.

But I get the 500 FastCGI error.

error code:"0x8007010b"

Here are the steps I've taken:

OS:windows10

Python version:3.6.5

1.install url rewrite2.0

2.pip install wfastcgi

3.Enable wfastcgi

4.create HelloAPI.py

5.create web.config

HelloAPI.py

from flask import Flask
app=Flask(__name__)

@app.route('/',methods=['GET'])
def index():
    return "Hello Flask!"

if __name__=='__main__':
    app.run(debug=True)

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="FlaskFastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="d:\users\hhhung1\appdata\local\programs\python\python36-32\python.exe|d:\users\hhhung1\appdata\local\programs\python\python36-32\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
    <security> 
        <requestFiltering allowDoubleEscaping="true"></requestFiltering> 
    </security> 
  </system.webServer>

  <appSettings>
    <!-- Required settings -->
    <add key="WSGI_HANDLER" value="HelloAPI.app" />
    <add key="PYTHONPATH" value="~/" />
  </appSettings>
</configuration>

Is there something I miss?

python
iis
flask
fastcgi
asked on Stack Overflow Oct 11, 2018 by EvaHHHH • edited Oct 11, 2018 by EvaHHHH

2 Answers

1

Problem solved. I grant the r/w right to python.exe folder and it works fine now.

answered on Stack Overflow Nov 19, 2019 by EvaHHHH
0

You need to have read and execute permissions on the whole python folder that has python.exe for "IIS AppPool\DefaultAppPool"

answered on Stack Overflow Mar 1, 2021 by max

User contributions licensed under CC BY-SA 3.0