Merge pull request #47 from frontfoot/production_environment

Run in production mode by default
This commit is contained in:
Nicholas Charriere 2017-01-03 11:55:42 -08:00 committed by GitHub
commit ad4012dfbe
2 changed files with 5 additions and 1 deletions

View file

@ -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 `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. 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 .. _Flask Documentation: http://flask.pocoo.org/docs/quickstart/#sessions
`STATIC_URL` this should be the location of your static assets. You might not `STATIC_URL` this should be the location of your static assets. You might not

View file

@ -10,6 +10,8 @@ from flask import abort, Flask, render_template, request
NO_SSL = os.environ.get('NO_SSL', False) NO_SSL = os.environ.get('NO_SSL', False)
app = Flask(__name__) app = Flask(__name__)
if os.environ.get('DEBUG'):
app.debug = True
app.secret_key = os.environ.get('SECRET_KEY', 'Secret Key') app.secret_key = os.environ.get('SECRET_KEY', 'Secret Key')
app.config.update( app.config.update(
dict(STATIC_URL=os.environ.get('STATIC_URL', 'static'))) dict(STATIC_URL=os.environ.get('STATIC_URL', 'static')))
@ -108,7 +110,7 @@ def show_password(password_key):
@check_redis_alive @check_redis_alive
def main(): def main():
app.run(host='0.0.0.0', debug=True) app.run(host='0.0.0.0')
if __name__ == '__main__': if __name__ == '__main__':