From d9fc13f350839891d2bebf37b1cd704c8e0c34e9 Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Tue, 19 Aug 2025 18:55:03 -0400 Subject: [PATCH] Fix PostGIS backend configuration - Properly override database engine to use PostGIS after dj_database_url parsing - Ensures spatial database operations work correctly with PostgreSQL PostGIS --- thrillwiki/settings.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/thrillwiki/settings.py b/thrillwiki/settings.py index 074fc7dc..a1ca56b4 100644 --- a/thrillwiki/settings.py +++ b/thrillwiki/settings.py @@ -93,16 +93,19 @@ WSGI_APPLICATION = "thrillwiki.wsgi.application" # Database -DATABASES = { - "default": dj_database_url.config( - default="[DATABASE-URL-REMOVED] - conn_max_age=600, - conn_health_checks=True, - ) -} +# Parse database URL but use PostGIS engine +db_config = dj_database_url.config( + default="[DATABASE-URL-REMOVED] + conn_max_age=600, + conn_health_checks=True, +) -# Ensure PostGIS backend is used -DATABASES["default"]["ENGINE"] = "django.contrib.gis.db.backends.postgis" +# Override engine to use PostGIS +db_config["ENGINE"] = "django.contrib.gis.db.backends.postgis" + +DATABASES = { + "default": db_config +} # Cache settings CACHES = {