Added configuration file support.

This commit is contained in:
Alexis Lahouze 2013-11-10 20:20:01 +01:00
parent 1f9e9ee650
commit 39db433854
3 changed files with 8 additions and 2 deletions

2
src/.gitignore vendored
View File

@ -1,2 +1,4 @@
*.pyc *.pyc
__pycache__ __pycache__
config.py

View File

@ -18,12 +18,13 @@
from flask import Flask from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
import config
# The app # The app
app = Flask(__name__) app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://accountant:accountant@localhost/accountant' app.config['SQLALCHEMY_DATABASE_URI'] = config.db_uri
app.config['SQLALCHEMY_RECORD_QUERIES'] = True app.config['SQLALCHEMY_RECORD_QUERIES'] = config.debug
db = SQLAlchemy(app) db = SQLAlchemy(app)

3
src/config.py.dist Normal file
View File

@ -0,0 +1,3 @@
db_uri='postgresql://accountant:accountant@localhost/accountant'
debug=True