So my web.config
currently looks like the following for production and the site works when I visit it
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python310\python.exe|C:\Python310\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<add key="WSGI_HANDLER" value="wsgi.app" />
<add key="PYTHONPATH" value="E:\apps\prod" />
<add accessType="Allow" users="*" />
</appSettings>
</configuration>
However reading https://docs.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2022#configure-the-httpplatform-handler it suggests that isn't the way to go so have amended the web.config
to the below
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="C:\Python310\python.exe"
arguments="E:\Apps\prod\wsgi.py --port %HTTP_PLATFORM_PORT%"
stdoutLogEnabled="true"
stdoutLogFile="E:\logs\python.log"
startupTimeLimit="60"
processesPerApplication="16">
<environmentVariables>
<environmentVariable name="SERVER_PORT" value="%HTTP_PLATFORM_PORT%" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Now, when I go to the site, it just spins around for a bit and the log file says:
* Serving Flask app 'digital' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on all addresses (0.0.0.0)
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://127.0.0.1:5000
* Running on http://x.x.x.x:5000 (Press CTRL+C to quit)
Sure enough if I go to the IP, it runs but when I go to my domain/hostname, it doesn't run and instead, hangs and logs the above to file
wsgi.py
"""
Application entry point
"""
from digital import init_app
app = init_app()
if __name__ == "__main__":
app.run(host="0.0.0.0",threaded=True)
Any suggestions?
Thanks