switched from sqlite to postgres
This commit is contained in:
parent
8225b18a2a
commit
94501bf986
22 changed files with 80 additions and 143 deletions
|
|
@ -11,7 +11,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
|
|||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import os
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
|
@ -42,6 +42,7 @@ INSTALLED_APPS = [
|
|||
'drf_spectacular',
|
||||
'corsheaders',
|
||||
'api.apps.ApiConfig',
|
||||
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
@ -89,21 +90,16 @@ WSGI_APPLICATION = 'testapi.wsgi.application'
|
|||
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'django.db.backends.postgresql',
|
||||
# 'NAME': 'drfapi', # Your database name
|
||||
# 'USER': 'postgres', # Your PostgreSQL username
|
||||
# 'PASSWORD': '1235', # Your PostgreSQL password
|
||||
# 'HOST': 'localhost', # Or your DB server's IP
|
||||
# 'PORT': '5432', # Default PostgreSQL port
|
||||
# }
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': os.environ.get("DB_NAME", "drfapi"),
|
||||
'USER': os.environ.get("DB_USER", "postgres"),
|
||||
'PASSWORD': os.environ.get("DB_PASSWORD", "1235"),
|
||||
'HOST': os.environ.get("DB_HOST", "localhost"),
|
||||
'PORT': os.environ.get("DB_PORT", "5432"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue