aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/views.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 2138146c..fdb49c7f 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -110,6 +110,9 @@ logger = utility.logger.getLogger(__name__)
def connect_db():
db = getattr(g, '_database', None)
if request.endpoint not in ("static", "js") and db is None:
+ logger.debug(
+ f"Creating a database connection\n"
+ f"\t\tfor request: {request.endpoint}")
g.db = g._database = sqlalchemy.create_engine(
SQL_URI, encoding="latin1")
@@ -118,8 +121,10 @@ def connect_db():
def shutdown_session(exception=None):
db = getattr(g, '_database', None)
if db is not None:
+ logger.debug(f"Removing the session")
g.db.dispose()
g.db = None
+ logger.debug(f"g.db: {g.db}\n\tg._database: {g._database}")
@app.errorhandler(Exception)