How to ?
- Installing IIS on your window
- Create Flask App (ex: main.py) and download WSGI file .
- Configuring on IIS
- Run an application
Installing IIS on your window
Go to search Turn Windows features on or off and click on it .
Now click on the Internet Information Services check box.
After you need to install CGI and click ok.
If you want to know your IIS work or not please go to your browser and type this url localhost by default.
Create Flask App (ex: main.py)
In this section I will create python file called name main.py and put some code here to print “Hello Python !” on screen .
When you want to hosing flask app in IIS it will need wfastcgi file you can download here wfastcgi.
Configuring on IIS
In this section I will show you how to configure and hosting python file in IIS . First go to start and type word IIS and open it .
Now go to add site tab on the left of navigation and select Add Website on the right next browse to your app directory and click ok.
Now you need to add module mapping go to your site and double click on Handler Mappings
Click Add Module Mapping on the right . and browse to your environment and wfastcgi file.
Click Request Restrictions. Make sure “Invoke handler only if request is mapped to:” checkbox is unchecked ” and click ok.
Go to your root server and double click on FastCGI Setting and click on Edit
click on “…” to add environment variables click on add Name to “WSGI_HANDLER” and Value to “main.app” . Value is depend on your app python file and then click ok.
Run an application
Go to your site and click on Browse