-1
from flask import Flask

app = Flask(_name_)

@app.route('/')
def index():
    return '<h1>Hello, world</h1>'

I get this error * Serving Flask app "application.py" * 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

Monica
  • 7
  • 1
  • 2
  • 3
    Does this answer your question? [Warning message while running Flask](https://stackoverflow.com/questions/50284753/warning-message-while-running-flask) – Jay Mody May 21 '20 at 02:31

2 Answers2

1

This is just a warning as flask server is not meant for production. You can use

export FLASK_ENV=development

before flask run

JaskiratSra
  • 112
  • 2
0

It depends if you are running it from command line or adding python code to run it.

If you want to run it with Python, add this to the bottom of your code.

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=80)

(you can change the port number, to access it on a browser, type: 127.0.0.1:80)

If you are running it from command line, you run

flask run

Note this appears every time:

Serving Flask app "application.py" * 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

All it tells you is that this server is only used for development or production. Hosting it for commercial/public use would require additional files and web hosting.

You can allow debugging to be on with

if __name__ == "__main__":
        app.run(host='0.0.0.0', port=80, DEBUG=True)

OR

export FLASK_ENV=development (linux/macos)
set FLASK_ENV=development (Windows)

Hope this helps (follow me on GitHub @haydenso)

haydso
  • 36
  • 4