Click here to Skip to main content
16,021,169 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I am trying to deploy Python flask app in IIS


python Code
from flask import Flask
# Create a Flask application instance
app = Flask(__name__)
# Define a route and a corresponding function
@app.route('/')
def hello():
    return 'Hello, World!'
# Run the application if this script is executed directly
if __name__ == '__main__':
  app.run()`


`
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="SampleModulehandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\WebApplications\SampleApp\samplevenv\Scripts\python.exe|D:\WebApplications\SampleApp\samplevenv\lib\site-packages\wfastcgi.py" resourceType="Unspecified" />
    </handlers>
    </system.webServer>
    <appSettings>
    <add key="WSGI_HANDLER" value="flaskiis.app" /> <!-- {name_of_file}.{name_of_flask_app}-->
    <add key="PYTHONPATH" value="D:\WebApplications\SampleApp" />
    </appSettings>
</configuration>`


What I have tried:

`
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="SampleModulehandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\WebApplications\SampleApp\samplevenv\Scripts\python.exe|D:\WebApplications\SampleApp\samplevenv\lib\site-packages\wfastcgi.py" resourceType="Unspecified" />
    </handlers>
    </system.webServer>
    <appSettings>
    <add key="WSGI_HANDLER" value="flaskiis.app" /> <!-- {name_of_file}.{name_of_flask_app}-->
    <add key="PYTHONPATH" value="D:\WebApplications\SampleApp" />
    </appSettings>
</configuration>`
Posted
Updated 19-Jun-23 22:11pm

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900