diff --git a/core/settings.py b/core/settings.py index 3ea8592..d66f251 100644 --- a/core/settings.py +++ b/core/settings.py @@ -9,9 +9,13 @@ https://docs.djangoproject.com/en/5.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.0/ref/settings/ """ - +import environ +import os from pathlib import Path +env = environ.Env() +environ.Env.read_env(os.path.join(BASE_DIR, '.env')) + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -85,18 +89,17 @@ WSGI_APPLICATION = 'core.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'tsreshub_db', - 'USER': 'tsreshub_prod', - 'PASSWORD': 'Tr5h$Prod!92@TsRH', - 'HOST': '39.101.135.56', - 'PORT': '3306', + 'NAME': env('DB_NAME'), + 'USER': env('DB_USER'), + 'PASSWORD': env('DB_PASSWORD'), + 'HOST': env('DB_HOST'), + 'PORT': env('DB_PORT'), 'OPTIONS': { 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", } } } - # Password validation # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators