This commit is contained in:
slice 2018-06-16 17:00:08 -07:00
parent 8406188f5b
commit 6350ff688c
No known key found for this signature in database
GPG Key ID: 1508C19D7436A26D
1 changed files with 2 additions and 5 deletions

7
run.py
View File

@ -19,20 +19,17 @@ app = make_app()
@app.before_serving @app.before_serving
async def create_db_pool(): async def app_before_serving():
"""Startup tasks for app"""
log.info('opening db') log.info('opening db')
app.db_pool = await asyncpg.create_pool(**app.config['POSTGRES']) app.db_pool = await asyncpg.create_pool(**app.config['POSTGRES'])
@app.after_serving @app.after_serving
async def close_db_pool(): async def app_after_serving():
"""Close the DB connection."""
log.info('closing db') log.info('closing db')
await app.db_pool.close() await app.db_pool.close()
@app.route('/') @app.route('/')
async def index(): async def index():
"""Base handler for /."""
return 'hai' return 'hai'