aboutsummaryrefslogtreecommitdiffstats
path: root/manage.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2021-09-07 09:38:16 +0100
committerGravatar Chris Lovering <[email protected]>2021-09-07 09:40:05 +0100
commit6de87e47e313b4f533e8d3adfeb0b8202e938ca0 (patch)
tree2c6995c307636c32c3b8344e14c979b959261252 /manage.py
parentMove db url validation to cls method (diff)
Close db conns when finished
psycopg2's context managers don't do this for us, so we need to close conns manually.
Diffstat (limited to 'manage.py')
-rwxr-xr-xmanage.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/manage.py b/manage.py
index 70855ba8..cb4eb567 100755
--- a/manage.py
+++ b/manage.py
@@ -173,6 +173,7 @@ class SiteManager:
return
print("Creating metricity relations and populating with some data.")
cursor.execute("CREATE DATABASE metricity")
+ conn.close()
# Switch connection to metricity and initialise some data
conn = psycopg2.connect(
@@ -181,6 +182,7 @@ class SiteManager:
)
with conn.cursor() as cursor, open("postgres/init.sql", encoding="utf-8") as f:
cursor.execute(f.read())
+ conn.close()
def prepare_server(self) -> None:
"""Perform preparation tasks before running the server."""