fix(frontend): 掛載 V2 static assets
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
> 本文件定義專案開發的核心準則與不可違反的規範
|
||||
> **建立日期**: 2026-01-12
|
||||
> **當前版本**: V10.33 (Frontend v2 dashboard feature flag)
|
||||
> **當前版本**: V10.34 (Frontend v2 static assets mounted)
|
||||
> **最後更新**: 2026-04-30
|
||||
|
||||
---
|
||||
|
||||
4
app.py
4
app.py
@@ -95,8 +95,8 @@ except Exception as e:
|
||||
sys_log.error(f"無法檢測磁碟空間: {e}")
|
||||
|
||||
# 🚩 系統版本定義 (備份與顯示用)
|
||||
# 🚩 2026-04-30 V10.33: Frontend v2 dashboard feature flag
|
||||
SYSTEM_VERSION = "V10.33"
|
||||
# 🚩 2026-04-30 V10.34: Frontend v2 static assets mounted
|
||||
SYSTEM_VERSION = "V10.34"
|
||||
|
||||
# ==========================================
|
||||
# 🔒 SQL Injection 防護函數
|
||||
|
||||
@@ -254,7 +254,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
|
||||
# ==========================================
|
||||
# 系統版本與路徑
|
||||
# ==========================================
|
||||
SYSTEM_VERSION = "V10.33"
|
||||
SYSTEM_VERSION = "V10.34"
|
||||
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
|
||||
public_url = PUBLIC_URL # 用於模板顯示
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ services:
|
||||
- ./routes:/app/routes:ro
|
||||
- ./database:/app/database:ro
|
||||
- ./utils:/app/utils:ro
|
||||
- ./static:/app/static:ro
|
||||
# HTML 模板 (熱更新)
|
||||
- ./templates:/app/templates:ro
|
||||
- ./web/templates:/app/web/templates:ro
|
||||
|
||||
@@ -55,8 +55,9 @@
|
||||
- **CD sync mount drift guard**: 發現舊 app 容器未掛載 `app.py/config.py` 時,rsync 後服務檔已更新但 `/health` 版本仍卡 image 內舊檔;CD sync 會檢查 mount,僅 drift 時一次性 recreate momo-app,其餘維持 HUP 熱重載。
|
||||
- **CD 單檔 bind mount inode 修復**: `app.py/config.py` 單檔 bind mount 會被 rsync/tar 的 inode replacement 卡住舊檔,CD rsync 改用 `--inplace`,避免 HUP reload 後仍讀到舊版本。
|
||||
- **Frontend V2 視覺基準立案**: `MOMO Pro/` prototype 與 `docs/guides/frontend_upgrade_roadmap.md` 成為前端更版依據,AGENTS/CONSTITUTION 改以米色工作台、暖墨文字、焦糖橘 accent 與新版 shell 規範作為後續 UI 基準。
|
||||
- **Frontend V2 Phase 0 assets**: 新增 `web/static/css/ewoooc-tokens.css`、`web/static/css/ewoooc-shell.css`、`templates/ewoooc_base.html` 與 `_ewoooc_shell.html`,先建立可重用 shell,不替換既有頁面;憲章補「真實資料與真實頁面」紅線,禁止假資料冒充完成。
|
||||
- **Frontend V2 Phase 0 assets**: 新增 `static/css/ewoooc-tokens.css`、`static/css/ewoooc-shell.css`、`templates/ewoooc_base.html` 與 `_ewoooc_shell.html`,先建立可重用 shell,不替換既有頁面;憲章補「真實資料與真實頁面」紅線,禁止假資料冒充完成。
|
||||
- **Dashboard V2 feature flag**: `/` 預設仍走既有 `dashboard.html`,`/?ui=v2` 才渲染 `dashboard_v2.html`;新版頁沿用既有 dashboard 真實資料與篩選/排序參數,不建立 mock 商品或假 KPI。
|
||||
- **Frontend V2 static mount**: `momo-app` 補 `./static:/app/static:ro`,確保 Flask `url_for('static', filename='css/ewoooc-*.css')` 能由 bind-mounted static 目錄熱更新。
|
||||
|
||||
### 2026-04-28~29:Phase 3e 重構大戰 + daily_sales cache 隱形 bug 根除
|
||||
- **app.py 縮減 -10.8%**: 7,386 → 6,590 行,11 commits 全綠零 502。
|
||||
|
||||
@@ -10,3 +10,4 @@ def test_momo_app_mounts_gunicorn_config_for_sync_deploys():
|
||||
|
||||
assert 'command: ["gunicorn", "--config", "gunicorn.conf.py", "app:app"]' in compose
|
||||
assert "- ./gunicorn.conf.py:/app/gunicorn.conf.py:ro" in compose
|
||||
assert "- ./static:/app/static:ro" in compose
|
||||
|
||||
@@ -5,8 +5,8 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_frontend_v2_shell_assets_exist_and_are_indexed():
|
||||
assert (ROOT / "web/static/css/ewoooc-tokens.css").exists()
|
||||
assert (ROOT / "web/static/css/ewoooc-shell.css").exists()
|
||||
assert (ROOT / "static/css/ewoooc-tokens.css").exists()
|
||||
assert (ROOT / "static/css/ewoooc-shell.css").exists()
|
||||
assert (ROOT / "templates/ewoooc_base.html").exists()
|
||||
assert (ROOT / "templates/components/_ewoooc_shell.html").exists()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user