Skip to content

Commit

Permalink
Add the use of postgresSQL to prod
Browse files Browse the repository at this point in the history
  • Loading branch information
danielMoreirad committed Mar 22, 2024
1 parent 8d653a1 commit d3ad9e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
25 changes: 19 additions & 6 deletions api/arconnectmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
tzdata==2024.1
psycopg-binary==3.1.8
psycopg==3.1.8

0 comments on commit d3ad9e6

Please sign in to comment.