change settings.py variable for .env config file
This commit is contained in:
1 parent
bb75e58489
commit
2ebc57fa98
1 file changed
+14
-9
+14
-9
@@ -10,7 +10,12 @@ For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Lädt die Variablen aus der .env Datei
|
||||
load_dotenv()
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@@ -20,12 +25,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-#xh(_vl!ccdoop$+6@ze-g%%o9dn%ks(b!2c0=w)rxq25p5(p%'
|
||||
SECRET_KEY = os.getenv('SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = os.getenv('DEBUG') == 'True'
|
||||
|
||||
ALLOWED_HOSTS = ["gd.pi.lan"]
|
||||
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost').split(',')
|
||||
|
||||
|
||||
# Application definition
|
||||
@@ -86,12 +91,12 @@ WSGI_APPLICATION = 'project.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.mysql",
|
||||
"NAME": "hansolo_django_gd",
|
||||
"USER": "hansolo_django_gd",
|
||||
"PASSWORD": "Django123",
|
||||
"HOST": "localhost",
|
||||
"PORT": "3306",
|
||||
'ENGINE': "django.db.backends.mysql",
|
||||
'NAME': os.getenv('DB_NAME'),
|
||||
'USER': os.getenv('DB_USER'),
|
||||
'PASSWORD': os.getenv('DB_PASSWORD'),
|
||||
'HOST': os.getenv('DB_HOST'),
|
||||
'PORT': os.getenv('DB_PORT'),
|
||||
"OPTIONS": {
|
||||
"init_command": "SET sql_mode='STRICT_TRANS_TABLES'",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user