Add decouple + config
Use python-decouple Config method to load the config values (debug, database, secret_key...) more to come
This commit is contained in:
parent
a50b457585
commit
d727afe5b8
@ -12,4 +12,5 @@ MYSQL_PASSWORD=pass
|
||||
MYSQL_ROOT_PASSWORD=pass
|
||||
|
||||
DEBUG=True
|
||||
SECRET_KEY=django-secret-key-123123-abcabc
|
||||
DJANGO_SETTINGS_MODULE=project.settings.devel
|
||||
|
@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from decouple import config
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@ -20,10 +21,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-h#0))ubik6g6_azpi-0tf)=y%@m&488#2io&(5x+k^)10ns_41'
|
||||
SECRET_KEY = config('SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = config('DEBUG', default=False, cast=bool)
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
@ -75,8 +76,12 @@ WSGI_APPLICATION = 'blueskydj.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': config('MYSQL_DATABASE'),
|
||||
'USER': config('MYSQL_USER'),
|
||||
'PASSWORD': config('MYSQL_PASSWORD'),
|
||||
'HOST': config('MYSQL_HOST'),
|
||||
'PORT': config('MYSQL_PORT'),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
asgiref==3.8.1
|
||||
Django==5.1.3
|
||||
sqlparse==0.5.2
|
||||
python-decouple==3.8
|
||||
|
Loading…
Reference in New Issue
Block a user