Remove unnecessary calls to the database for user and permission metadata.
This commit is contained in:
parent
13298be5d3
commit
959016a6eb
5 changed files with 58 additions and 39 deletions
|
@ -14,18 +14,12 @@ db = app.config['DB_DRIVER'](app.config['DB_NAME'],
|
|||
**app.config['DB_CONNECTION_ARGS'])
|
||||
|
||||
|
||||
def connect_db():
|
||||
logger.debug('Connectin to database.')
|
||||
db.connect()
|
||||
|
||||
|
||||
def close_db(exc):
|
||||
if not db.is_closed():
|
||||
logger.debug('Disconnecting from database.')
|
||||
db.close()
|
||||
|
||||
|
||||
app.before_request(connect_db)
|
||||
app.teardown_request(close_db)
|
||||
|
||||
|
||||
|
|
Reference in a new issue