From 300f2fec72ce8e7143e0c954074690224f6d0f70 Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Thu, 23 Aug 2012 15:57:37 -0400 Subject: Version with official config support --- wqflask/cfg/__init__.py | 0 wqflask/cfg/default_settings.py | 1 + wqflask/wqflask/__init__.py | 4 ++++ wqflask/wqflask/search_results.py | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 wqflask/cfg/__init__.py create mode 100644 wqflask/cfg/default_settings.py (limited to 'wqflask') diff --git a/wqflask/cfg/__init__.py b/wqflask/cfg/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/cfg/default_settings.py b/wqflask/cfg/default_settings.py new file mode 100644 index 00000000..30ad51d1 --- /dev/null +++ b/wqflask/cfg/default_settings.py @@ -0,0 +1 @@ +LOGFILE = """/tmp/flask_gn_log""" diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py index a6119dcc..a7492e77 100644 --- a/wqflask/wqflask/__init__.py +++ b/wqflask/wqflask/__init__.py @@ -9,6 +9,10 @@ from utility import formatting app = Flask(__name__) +# See http://flask.pocoo.org/docs/config/#configuring-from-files +app.config.from_object('cfg.default_settings') +app.config.from_envvar('WQFLASK_SETTINGS') + app.jinja_env.globals.update( numify = formatting.numify ) diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index ce7a6eef..d393d0c1 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -36,7 +36,7 @@ from utility import webqtlUtil from dbFunction import webqtlDatabaseFunction import logging -logging.basicConfig(filename="/tmp/flask_gn_log", level=logging.INFO) +logging.basicConfig(filename=app.config['LOGFILE'], level=logging.INFO) _log = logging.getLogger("search") _ch = logging.StreamHandler() -- cgit v1.2.3