Add debugging.

This commit is contained in:
Alexis Lahouze 2015-07-10 14:59:37 +02:00
parent 3708fc637a
commit 968e8b5976
2 changed files with 15 additions and 1 deletions

View File

@ -16,11 +16,21 @@
""" """
from contextlib import contextmanager from contextlib import contextmanager
import logging
from flask import Flask from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.sqlalchemy import SQLAlchemy
from . import config from . import config
logging.basicConfig()
if config.debug:
logging.getLogger().setLevel(logging.DEBUG)
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
else:
logging.getLogger().setLevel(logging.INFO)
# The app # The app
app = Flask(__name__, static_folder=None) app = Flask(__name__, static_folder=None)
@ -29,6 +39,8 @@ app.config['SQLALCHEMY_RECORD_QUERIES'] = config.debug
app.config['WTF_CSRF_ENABLED'] = False app.config['WTF_CSRF_ENABLED'] = False
app.config['SECRET_KEY'] = 'my_secret_key' app.config['SECRET_KEY'] = 'my_secret_key'
app.debug = config.debug
db = SQLAlchemy(app) db = SQLAlchemy(app)

View File

@ -1,3 +1,5 @@
# Daabase connection URI
db_uri='postgresql://accountant:accountant@localhost/accountant' db_uri='postgresql://accountant:accountant@localhost/accountant'
# Debug
debug=True debug=True