From c5ed15da3def3e260e3b8c593aad2464d1b96204 Mon Sep 17 00:00:00 2001 From: Penny <enderman542@gmail.com> Date: Tue, 29 Oct 2024 23:03:31 +0900 Subject: [PATCH] config db in django --- app/app/settings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/app/settings.py b/app/app/settings.py index 7a140be..50e27a6 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -10,6 +10,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/ """ +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -75,8 +76,11 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.postgresql', + 'HOST': os.environ.get('DB_HOST'), + 'NAME': os.environ.get('DB_NAME'), + 'USER': os.environ.get('DB_USER'), + 'PASSWORD': os.environ.get('DB_PASS'), } }