diff options
author | 2021-09-07 09:38:16 +0100 | |
---|---|---|
committer | 2021-09-07 09:40:05 +0100 | |
commit | 6de87e47e313b4f533e8d3adfeb0b8202e938ca0 (patch) | |
tree | 2c6995c307636c32c3b8344e14c979b959261252 /manage.py | |
parent | Move 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-x | manage.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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.""" |