From 39db4338542c804270a5b36adb8ac57287d90fc9 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 10 Nov 2013 20:20:01 +0100 Subject: [PATCH] Added configuration file support. --- src/.gitignore | 2 ++ src/app.py | 5 +++-- src/config.py.dist | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/config.py.dist diff --git a/src/.gitignore b/src/.gitignore index a295864..723fb5e 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,2 +1,4 @@ *.pyc __pycache__ +config.py + diff --git a/src/app.py b/src/app.py index 7fa75b5..82c12cf 100644 --- a/src/app.py +++ b/src/app.py @@ -18,12 +18,13 @@ from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from sqlalchemy.orm import sessionmaker +import config # The app app = Flask(__name__) -app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://accountant:accountant@localhost/accountant' -app.config['SQLALCHEMY_RECORD_QUERIES'] = True +app.config['SQLALCHEMY_DATABASE_URI'] = config.db_uri +app.config['SQLALCHEMY_RECORD_QUERIES'] = config.debug db = SQLAlchemy(app) diff --git a/src/config.py.dist b/src/config.py.dist new file mode 100644 index 0000000..1dafb97 --- /dev/null +++ b/src/config.py.dist @@ -0,0 +1,3 @@ + +db_uri='postgresql://accountant:accountant@localhost/accountant' +debug=True