""" Run a Flask app in production or development/debug from the command line If you wish to run a Flask app with Python instead of the `flask run` command, this code provides an easier way to decide if you want to run it in production or debug mode. Usage: python flaskserver.py dev # runs with debug set to True python flaskserver.py # production mode """ import sys from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello, world!" if __name__ == '__main__': is_debug = False if len(sys.argv) > 1 and sys.argv[1] == 'dev': is_debug = True app.run(debug=is_debug)