From d61c08c7c714ba07b262d195a94dd4facee5e7ba Mon Sep 17 00:00:00 2001 From: Joseph Boiteau Date: Tue, 20 Dec 2016 15:24:26 +1100 Subject: [PATCH] Run in production mode by default Use DEBUG environment variable to run debug mode --- README.rst | 2 ++ snappass/main.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2473bee..abde29f 100644 --- a/README.rst +++ b/README.rst @@ -53,6 +53,8 @@ You can configure the following via environment variables. `SECRET_KEY` this should be a unique key that's used to sign key. This should be kept secret. See the `Flask Documentation`_ for more information. +`DEBUG` to run Flask web werver in debug mode. See the `Flask Documentation`_ for more information. + .. _Flask Documentation: http://flask.pocoo.org/docs/quickstart/#sessions `STATIC_URL` this should be the location of your static assets. You might not diff --git a/snappass/main.py b/snappass/main.py index 04e0ef6..9d05f54 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -10,6 +10,8 @@ from flask import abort, Flask, render_template, request NO_SSL = os.environ.get('NO_SSL', False) app = Flask(__name__) +if os.environ.get('DEBUG'): + app.debug = True app.secret_key = os.environ.get('SECRET_KEY', 'Secret Key') app.config.update( dict(STATIC_URL=os.environ.get('STATIC_URL', 'static'))) @@ -108,7 +110,7 @@ def show_password(password_key): @check_redis_alive def main(): - app.run(host='0.0.0.0', debug=True) + app.run(host='0.0.0.0') if __name__ == '__main__':