This commit is contained in:
2025-03-03 09:18:48 +08:00
parent ce30694ada
commit f3b0d0dce0

View File

@@ -24,10 +24,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get("SECRET_KEY") SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = os.environ.get("ENV") != "production"
ALLOWED_HOSTS = ["webpreviewapi.xuyue.cc", "localhost", "127.0.0.1"]
if DEBUG:
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
else:
ALLOWED_HOSTS = ["webapi.xuyue.cc"]
# Application definition # Application definition
@@ -130,9 +132,9 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
AUTH_USER_MODEL = "account.User" AUTH_USER_MODEL = "account.User"
CORS_ALLOWED_ORIGINS = [ if DEBUG:
"http://localhost:3000", CORS_ALLOWED_ORIGINS = ["http://localhost:3000"]
"http://localhost:8081", else:
"https://web.xuyue.cc", CORS_ALLOWED_ORIGINS = ["https://web.xuyue.cc"]
]
CORS_ALLOW_CREDENTIALS = True CORS_ALLOW_CREDENTIALS = True