This commit is contained in:
2025-07-15 19:09:45 +08:00
parent 01e5c9097c
commit 7571792ed5
13 changed files with 115 additions and 4 deletions

View File

@@ -47,12 +47,14 @@ INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"channels",
"ninja",
"corsheaders",
"django_extensions",
"account",
"task",
"submission",
"chat",
]
MIDDLEWARE = [
@@ -85,7 +87,7 @@ TEMPLATES = [
]
WSGI_APPLICATION = "api.wsgi.application"
ASGI_APPLICATION = "api.asgi.application"
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
@@ -129,6 +131,16 @@ else:
# 配置缓存
CACHES = PROD_CACHES
# WebSocket 的缓存
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [(os.getenv("REDIS_HOST"), 6379)],
},
},
}
# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators