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")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ["webpreviewapi.xuyue.cc", "localhost", "127.0.0.1"]
DEBUG = os.environ.get("ENV") != "production"
if DEBUG:
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
else:
ALLOWED_HOSTS = ["webapi.xuyue.cc"]
# Application definition
@@ -130,9 +132,9 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
AUTH_USER_MODEL = "account.User"
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"http://localhost:8081",
"https://web.xuyue.cc",
]
if DEBUG:
CORS_ALLOWED_ORIGINS = ["http://localhost:3000"]
else:
CORS_ALLOWED_ORIGINS = ["https://web.xuyue.cc"]
CORS_ALLOW_CREDENTIALS = True