How to setup Flask web app on IIS in windows using Python 3.11

I’ve been struggling to get python 3.11 + flask app running within iis using wfastCGI. I havent found anythig about wfastcgi and 3.11 on;y 3.8, has anyone managed to achieve serving a flask app in iis under python 3.11?

Many thanks for any pointers, I’ve had chatGPT guiding me but running out of ideas.

Thanks!
Dale

What steps have you tried so far, and what went wrong when you tried that? Why do you suspect that 3.11 would need something different done vs 3.8?

ChatGPT cannot “guide” you to do anything. It can, at best, rephrase what are effectively search results in natural language.

Thanks for the reply

  • added fastCGi to iis
  • installed wfastcgi via pip
  • added a module mapping for FastCGI with request path *, executable C:\Users\compass\AppData\Local\Programs\Python\Python311\python.exe|C:\Users\compass\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfastcgi.py
  • request restrictions set to script, deselected invoke handler checkbox
  • made sure iis has read/write execute to the folder with python and flask app in it
  • created log folder for errors and made sire iis has write access to it
  • in flask folder created web.config with
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="PYTHONPATH" value="C:\python\fusion" />
    <add key="WSGI_HANDLER" value="app.app" />
    <add key="WSGI_LOG" value="C:\python\fusion\wfastcgi.log" />
  </appSettings>

  <system.webServer>
    <handlers>
      <add name="Flask" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\compass\AppData\Local\Programs\Python\Python311\python.exe|C:\Users\compass\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
  </system.webServer>
</configuration>

Can’t beat good old human help! So hoping for some words of wisdom!

Error I get is:

Detailed Error Information:

Module FastCgiModule
Notification ExecuteRequestHandler
Handler Flask
Error Code 0x8007010b
Requested URL https://pythonic.wtcc.sa.gov.au:443/mobilelibrary
Physical Path C:\python\fusion\mobilelibrary
Logon Method Negotiate

I don’t think it should be that physical path, seeing as the physical path is one level higher, it just seems to append the url path on. So that might be a symptom of whats wrong, but that s a guess.

Thanks
Dale

all good chatGPT came through with the good in the end and suggested that I add the application pool to have read,write execute permission to the python folder.

Not bad for search results :wink:

please turn on deature cgi