feat(k8s): 新增 core 真应用(前端+Django API+Celery worker)构建与部署
- core/frontend: Vite 多阶段镜像 + nginx 同源反代 /api,/admin,/static(零 CORS) - core/backend: Django gunicorn 镜像 + entrypoint(自动 migrate/collectstatic)+ WhiteNoise - k8s/core: api/worker/web Deployment+Service + ingress(airshelf-web.airlabs.art) - workflow: 追加 core 前后端 build/push,从 core/backend/.env 套生产覆盖生成 env Secret 后部署 - .gitignore 放行 core/backend/.env;.env 白名单加入 airshelf-web 域名 - 含前端 WIP 还原改动 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from .base import * # noqa: F403
|
||||
from .base import BASE_DIR, MIDDLEWARE
|
||||
|
||||
|
||||
DEBUG = False
|
||||
@@ -6,3 +9,16 @@ SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SECURE = True
|
||||
|
||||
# Serve admin/static behind gunicorn with DEBUG=False (no nginx static mount needed).
|
||||
# WhiteNoise sits right after SecurityMiddleware.
|
||||
MIDDLEWARE = (
|
||||
MIDDLEWARE[:1]
|
||||
+ ["whitenoise.middleware.WhiteNoiseMiddleware"]
|
||||
+ MIDDLEWARE[1:]
|
||||
)
|
||||
|
||||
STATIC_ROOT = Path(BASE_DIR) / "staticfiles"
|
||||
STORAGES = {
|
||||
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
|
||||
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user