Home > Enterprise >  Python Flask on IIS: WARNING: This is a development server. Do not use it in a production deployment
Python Flask on IIS: WARNING: This is a development server. Do not use it in a production deployment

Time:07-07

We followed this guide on setting up Flask on IIS https://medium.com/@dpralay07/deploy-a-python-flask-application-in-iis-server-and-run-on-machine-ip-address-ddb81df8edf3 and it works well but when we do flask run from VS code we get the following

PS J:\Apps\prod> flask run
 * Serving Flask app 'wsgi.py' (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 http://127.0.0.1:5000 (Press CTRL C to quit)

About the development server line and the production WSGI server line - is this purely because we set it up in IIS? Should we have followed a different route than what was in that guide we followed?

Everything else I'm seeing seems to be only relevant to *nix based systems i.e using Gunicorn

Thanks

CodePudding user response:

I see you are working in a development environment. Run the following code to set you environment to development mode to remove the warning:

export FLASK_APP=your-flask-app-name
export FLASK_ENV=development
flask run

CodePudding user response:

This warning means that you are using the standard flask server. Of course, it should not be used in production. You need to use some kind of wsgi-server like gunicorn, uwsgi, waitress etc. Check out the deployment documentation so you can properly deploy your Flask application. Well, and to remove the inscription;)

  • Related