+ load .env file via dotenv library

This commit is contained in:
Phil Zhitnikov 2024-04-28 01:06:03 +04:00
parent c53017564b
commit b820e3ee9f
2 changed files with 4 additions and 1 deletions

View File

@ -14,6 +14,9 @@ from pathlib import Path
import sentry_sdk import sentry_sdk
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from dotenv import load_dotenv
load_dotenv()
# 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
@ -34,7 +37,6 @@ def get_secret(setting):
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_secret("SECRET_KEY") SECRET_KEY = get_secret("SECRET_KEY")
# External API settings # External API settings
CDEK_CLIENT_ID = get_secret("CDEK_CLIENT_ID") CDEK_CLIENT_ID = get_secret("CDEK_CLIENT_ID")
CDEK_CLIENT_SECRET = get_secret("CDEK_CLIENT_SECRET") CDEK_CLIENT_SECRET = get_secret("CDEK_CLIENT_SECRET")

View File

@ -23,6 +23,7 @@ aiohttp==3.9.4
tqdm==4.65.0 tqdm==4.65.0
django-debug-toolbar==4.1.0 django-debug-toolbar==4.1.0
requests==2.31.0 requests==2.31.0
python-dotenv==1.0.1
# Logging # Logging
sentry-sdk==1.34.0 sentry-sdk==1.34.0