Flask is a python based package that is used to develop restful api services (api services).
when you run your application (directly from a command window), you will get a message telling you that you should not use this app as its in production environment. running the app from a cmd and using it is very risky and not reliable. so how to use an application (web service) that developed using flask?
The answer is:
you can use the IIS to host a flask application, but how to do this?
1- Install IIS: You’ll need to make sure that IIS is installed and configured with the CGI role service (this enables FastCGI as well).
2- lunch the IIS, make sure to run it as an administrator.
- click yes for starting the Microsoft Web Platform
if you do not get this message, you need to install the Platform Installer
Search for WFastCGI
Select the appropriate Python version (3.4 or 2.7.9). Click “Add”, then click “Install”.
if you have problem in finding the WFastCGI, you need to download it from this page wfastcgi, you can run the following command:
pip install wfastcgi
3- copy the wfastcgi.py from C:\Python34 (may be named C:\Python34_x86 if you
had an existing Python34 directory) to your Flask application root.
4- Double click “Handler Mappings” (in the IIS)
5- Click “Add Module Mapping”
6- Click “Request Restrictions”. Make sure “Invoke handler only if request is mapped to:” checkbox is unchecked.
7- Go to the root server settings and click “FastCGI Settings”.
8- Double click it, then click the “…” for the Environment Variables collection to launch the Environment Variables Collection Editor.
9- Set the PYTHONPATH variable:
- Name: PYTHONPATH, Value: your site directory
10- set the WSGI_HANDLER (my Flask app is named app.py so the value is app.app - if yours is named site.py it would be site.app or similar)
11- that set.
the credit is for this page, you will find more details.
Deploying Flask on IIS