This commit is contained in:
@ -13,19 +13,21 @@ import os
|
||||
from dotenv import load_dotenv
|
||||
from pathlib import Path
|
||||
from datetime import timedelta
|
||||
import sys
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
# 우선순위: .env.dev > .env.prd > .env
|
||||
if os.path.exists(os.path.join(BASE_DIR, '.env.dev')):
|
||||
print("Read Environment File > Used : .env.dev")
|
||||
# print("Read Environment File > Used : .env.dev")
|
||||
load_dotenv(os.path.join(BASE_DIR, '.env.dev'))
|
||||
elif os.path.exists(os.path.join(BASE_DIR, '.env.prd')):
|
||||
print("Read Environment File > Used : .env.prd")
|
||||
# print("Read Environment File > Used : .env.prd")
|
||||
load_dotenv(os.path.join(BASE_DIR, '.env.prd'))
|
||||
else:
|
||||
print("None Environment File > Used : local_env")
|
||||
pass
|
||||
# print("None Environment File > Used : local_env")
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||
@ -36,6 +38,56 @@ SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-ec9me^z%x7-2vwee5#qq(
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = int(os.environ.get('DEBUG', 1))
|
||||
|
||||
LOG_LEVEL = "DEBUG" if DEBUG else "INFO"
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False, # Django 기본 로거 유지
|
||||
'formatters': {
|
||||
'standard': {
|
||||
'format': '[{asctime}] {levelname} {name}:{lineno} {message}',
|
||||
'style': '{',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler', # 콘솔 출력
|
||||
'formatter': 'standard',
|
||||
'stream': sys.stdout, # 표준 출력 스트림
|
||||
'level': LOG_LEVEL, # 콘솔 출력 레벨 설정
|
||||
# 'filters': [], # 필터 설정 (필요시 추가)
|
||||
# 'encoding': 'utf-8', # UTF-8 인코딩 설정
|
||||
# 'force': True, # 강제로 콘솔 출력
|
||||
},
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': LOG_LEVEL, # 루트 로거 레벨 설정
|
||||
},
|
||||
'loggers': {
|
||||
'django': {
|
||||
'handlers': ['console'],
|
||||
'level': 'INFO', # Django 프레임워크 전반
|
||||
'propagate': False,
|
||||
},
|
||||
'django.request': {
|
||||
'handlers': ['console'],
|
||||
'level': 'ERROR', # 요청 관련 에러만 (500 에러 같은 것)
|
||||
'propagate': False,
|
||||
},
|
||||
'django.db.backends': {
|
||||
'handlers': ['console'],
|
||||
'level': 'WARNING', # DB 쿼리 경고만
|
||||
'propagate': False,
|
||||
},
|
||||
'django.security': {
|
||||
'handlers': ['console'],
|
||||
'level': 'WARNING', # 보안 관련 경고
|
||||
'propagate': False,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
AUTH_VERIFY_URL = os.environ.get('AUTH_VERIFY_URL', 'NONE')
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
Reference in New Issue
Block a user