diff --git a/api/arconnectmanager/settings.py b/api/arconnectmanager/settings.py index 59a948f..2c0b6ae 100644 --- a/api/arconnectmanager/settings.py +++ b/api/arconnectmanager/settings.py @@ -104,13 +104,26 @@ # Database # https://docs.djangoproject.com/en/5.0/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', +# Configuration de la base de données pour l'environnement local +if env('ENVIRONMENT') == 'local': + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } + } +# Configuration de la base de données pour l'environnement de production +else: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': env('POSTGRES_DATABASE'), + 'USER': env('POSTGRES_USER'), + 'PASSWORD': env('POSTGRES_PASSWORD'), + 'HOST': env('POSTGRES_HOST'), + 'PORT': env('POSTGRES_PORT'), + } } -} - # Password validation # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators diff --git a/api/requirements.txt b/api/requirements.txt index 5daa2f2..bd293d2 100644 --- a/api/requirements.txt +++ b/api/requirements.txt @@ -6,4 +6,6 @@ django-environ==0.11.2 django-rest-framework==0.1.0 djangorestframework==3.15.0 sqlparse==0.4.4 -tzdata==2024.1 \ No newline at end of file +tzdata==2024.1 +psycopg-binary==3.1.8 +psycopg==3.1.8 \ No newline at end of file