From 223778d0ff59cc113957eb812d18f56bb44b4fb0 Mon Sep 17 00:00:00 2001
From: Neda Moeini <neda.moeini@geant.org>
Date: Wed, 5 Mar 2025 13:31:29 +0100
Subject: [PATCH] Update database settings to use PostgreSQL and add psycopg
 dependency

---
 requirements.txt            | 1 +
 sage_validation/settings.py | 8 ++++++--
 setup.py                    | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index 897e939..a1b9380 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,3 +12,4 @@ pytest-mock
 faker
 coverage
 social-auth-app-django==5.4.3
+psycopg[binary,pool]
\ No newline at end of file
diff --git a/sage_validation/settings.py b/sage_validation/settings.py
index 697c7f1..356c84c 100644
--- a/sage_validation/settings.py
+++ b/sage_validation/settings.py
@@ -84,8 +84,12 @@ WSGI_APPLICATION = "sage_validation.wsgi.application"
 
 DATABASES = {
     "default": {
-        "ENGINE": "django.db.backends.sqlite3",
-        "NAME": BASE_DIR / "db.sqlite3",
+        'ENGINE': 'django.db.backends.postgresql',
+        'NAME': os.getenv("POSTGRES_DB_NAME", "sage_validation_db"),
+        'USER': os.getenv("POSTGRES_DB_USER", "sage_user"),
+        'PASSWORD': os.getenv("POSTGRES_DB_PASSWORD", "sage_password"),
+        'HOST': os.getenv("POSTGRES_DB_HOST", "localhost"),
+        'PORT': os.getenv("POSTGRES_DB_PORT", "5432"),
     },
     "meo": {
         'ENGINE': 'mssql',
diff --git a/setup.py b/setup.py
index 027fc84..f4ffd2f 100644
--- a/setup.py
+++ b/setup.py
@@ -11,6 +11,7 @@ setup(
         "mssql-django==1.5",
         "djangorestframework==3.15.2",
         "social-auth-app-django==5.4.3",
+        "psycopg[binary,pool]",
     ],
     extras_require={
         "prod": [
-- 
GitLab