From 6de87e47e313b4f533e8d3adfeb0b8202e938ca0 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 7 Sep 2021 09:38:16 +0100 Subject: Close db conns when finished psycopg2's context managers don't do this for us, so we need to close conns manually. --- manage.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'manage.py') 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.""" -- cgit v1.2.3