mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-20 14:34:06 +01:00
connect with PostgreSQL
This commit is contained in:
parent
e169be9340
commit
a82344029f
@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from decouple import config, Csv
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
@ -20,12 +21,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = 'django-insecure-47)&+$r648bswzins@+y)*!qhs2kshz4h09bb5-%zl@yay!n07'
|
SECRET_KEY = config('SECRET_KEY')
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = config('DEBUG', default=False, cast=bool)
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='*', cast=Csv())
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
@ -94,8 +95,12 @@ WSGI_APPLICATION = 'core.wsgi.application'
|
|||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
'NAME': config('DB_NAME'),
|
||||||
|
'USER': config('DB_USER'),
|
||||||
|
'PASSWORD': config('DB_PASSWORD'),
|
||||||
|
'HOST': config('DB_HOST'),
|
||||||
|
'PORT': config('DB_PORT'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
backend/sample.env
Normal file
8
backend/sample.env
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
SECRET_KEY=your_secret_key
|
||||||
|
DEBUG=False
|
||||||
|
ALLOWED_HOSTS=*.ku.th, localhost, 127.0.0.1, ::1
|
||||||
|
DB_NAME=your_DB_NAME
|
||||||
|
DB_USER=your_DB_USER
|
||||||
|
DB_PASSWORD=your_DB_PASSWORD
|
||||||
|
DB_HOST=your_DB_HOST
|
||||||
|
DB_PORT=your_DB_PORT
|
||||||
Loading…
Reference in New Issue
Block a user