Created
February 5, 2019 11:04
-
-
Save aalaap/4a1edfeaf2b6bccf5d401a0503fc77c6 to your computer and use it in GitHub Desktop.
Revisions
-
aalaap created this gist
Feb 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ """ 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)