apart settings.py && add local_settings.py

This commit is contained in:
2025-07-27 20:40:01 +08:00
parent 3d29569c22
commit dca4f7a1d0

View File

@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
""" """
from pathlib import Path from pathlib import Path
import os
# 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
@@ -112,7 +113,6 @@ USE_TZ = True
STATIC_URL = 'static/' STATIC_URL = 'static/'
# 添加媒体文件配置 # 添加媒体文件配置
import os
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
@@ -157,3 +157,10 @@ MDEDITOR_CONFIGS = {
} }
X_FRAME_OPTIONS = 'SAMEORIGIN' X_FRAME_OPTIONS = 'SAMEORIGIN'
# settings.py 末尾加上这段
try:
from .local_settings import *
except ImportError:
pass