I’m a novice python developer with very basic knowledge of this platform. We received a python app developed on Mac/Linux from a 3rd parry (consultant company), and I’m having trouble bind it to IIS on a WINDOWS WEB server.
Setting:
- Python 3.8.1, deploying flask and dash
- Windows server 2012R2
- IIS 8.5
Configuration:
Create a site under IIS (port 8051 in my test) and set the physical path to the folder where the runserver.py and web.config files reside.

- The rest of the configuration is administrated by a web.config file at the app’s root folder.
Successful Simple Test
- I successfully implemented a simple test file as follow:
runserver.py
from flask import Flask
app = Flask(__name__)
from datetime import datetime
from urllib.parse import urlparse
from flask import request
import socket
app.debug = True
@app.route('/')
def kuki():
return "Hello from flask over IIS. host:[{}], url:[{}], TS:[{}]".format(socket.gethostname(), request.base_url, datetime.now())
if __name__ == '__main__':
app.run()
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="PythonHandler" />
<add
name="PythonHandler"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="c:\python3_8_1\python.exe|c:\python3_8_1\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script"
/>
</handlers>
</system.webServer>
<appSettings>
<add key="PYTHONPATH" value="D:\_MyPython\HelloFlask" />
<add key="WSGI_HANDLER" value="runserver.app" />
<add key="WSGI_LOG" value="D:\_MyPython\HelloFlask\log\HelloFlask.log" />
</appSettings>
</configuration>
Problem running the full python app
The py -m application command is successfully launching the service
Can someone advice how to set the web.config file to enable successful IIS binding?
Thanks,
Shaul



