diff --git a/app.py b/app.py index 2a83c03..61befc2 100644 --- a/app.py +++ b/app.py @@ -131,25 +131,17 @@ if NGROK_AUTH_TOKEN == '36e27NM5V7sUJ8QxJIAAWCp7sUv_3brtcrBarYvcP3SbvFKhF': sys_log.warning("[Security] ⚠️ 使用預設 NGROK_AUTH_TOKEN,請設定環境變數") conf.get_default().auth_token = NGROK_AUTH_TOKEN -TEMPLATE_DIR = BASE_DIR # 修正:根據檔案結構,模板位於根目錄 -TEMPLATE_DIR_NEW = os.path.join(BASE_DIR, 'templates') # 新模板路徑(模組化) +TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates') STATIC_DIR = os.path.join(BASE_DIR, 'web/static') # 檢查關鍵模板是否存在 -if not os.path.exists(os.path.join(BASE_DIR, 'dashboard.html')): +if not os.path.exists(os.path.join(TEMPLATE_DIR, 'dashboard.html')): sys_log.warning(f"[Web] [Template] ⚠️ 警告: 找不到 dashboard.html | Path: {TEMPLATE_DIR}") app = Flask(__name__, template_folder=TEMPLATE_DIR, static_folder=STATIC_DIR) -# 設定多路徑模板載入器(同時支援根目錄和 templates/ 目錄) -from jinja2 import FileSystemLoader, ChoiceLoader -app.jinja_loader = ChoiceLoader([ - FileSystemLoader(TEMPLATE_DIR_NEW), # templates/ 目錄優先 - FileSystemLoader(TEMPLATE_DIR), # 根目錄備用 -]) - # ========================================== # 🔒 Flask 安全配置 # ========================================== diff --git a/docker-compose.yml b/docker-compose.yml index 982ea99..0713a00 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -67,27 +67,6 @@ services: # HTML 模板 (熱更新) - ./templates:/app/templates:ro - ./web/templates:/app/web/templates:ro - - ./login.html:/app/login.html:ro - - ./dashboard.html:/app/dashboard.html:ro - - ./daily_sales.html:/app/daily_sales.html:ro - - ./sales_analysis.html:/app/sales_analysis.html:ro - - ./growth_analysis.html:/app/growth_analysis.html:ro - - ./monthly_summary_analysis.html:/app/monthly_summary_analysis.html:ro - - ./edm_dashboard.html:/app/edm_dashboard.html:ro - - ./index.html:/app/index.html:ro - - ./logs.html:/app/logs.html:ro - - ./auto_import_index.html:/app/auto_import_index.html:ro - - ./settings.html:/app/settings.html:ro - - ./system_settings.html:/app/system_settings.html:ro - # 其他根目錄路由 - - ./auto_import_routes.py:/app/auto_import_routes.py:ro - - ./crawler_management_routes.py:/app/crawler_management_routes.py:ro - - ./import.html:/app/import.html:ro - # AI 助手模板及相關依賴 - - ./templates/ai_recommend.html:/app/ai_recommend.html:ro - - ./templates/ai_history.html:/app/ai_history.html:ro - - ./templates/base.html:/app/base.html:ro - - ./web/templates/components:/app/components:ro environment: - FLASK_ENV=production - PYTHONUNBUFFERED=1 diff --git a/logs.html b/logs.html deleted file mode 100644 index 5ff8be3..0000000 --- a/logs.html +++ /dev/null @@ -1,1183 +0,0 @@ - - - - - - 系統日誌 - MOMO 監控 - - - - - - {% include 'components/_navbar.html' %} - -
- - - - -
-
-
- -
-
-
0
-
總行數
-
-
-
-
- -
-
-
0
-
ERROR
-
-
-
-
- -
-
-
0
-
WARNING
-
-
-
-
- -
-
-
0
-
INFO
-
-
-
- - -
- -
-
主要操作
-
- - - - -
-
- - -
-
過濾與搜尋
-
-
- - - - -
- -
-
- - -
-
顯示選項
-
-
- 字體大小: -
- - - -
-
-
-
- - 自動滾動 -
-
-
-
-
- - -
-
-
- -

正在載入日誌...

-
-
-
-
- - -
- - - - - diff --git a/abc_analysis_detail.html b/templates/abc_analysis_detail.html similarity index 100% rename from abc_analysis_detail.html rename to templates/abc_analysis_detail.html diff --git a/auto_import_index.html b/templates/auto_import_index.html similarity index 100% rename from auto_import_index.html rename to templates/auto_import_index.html diff --git a/brand_assets.html b/templates/brand_assets.html similarity index 100% rename from brand_assets.html rename to templates/brand_assets.html diff --git a/templates/components b/templates/components deleted file mode 120000 index 3b3177d..0000000 --- a/templates/components +++ /dev/null @@ -1 +0,0 @@ -../web/templates/components \ No newline at end of file diff --git a/web/templates/components/_loading.html b/templates/components/_loading.html similarity index 100% rename from web/templates/components/_loading.html rename to templates/components/_loading.html diff --git a/web/templates/components/_navbar.html b/templates/components/_navbar.html similarity index 100% rename from web/templates/components/_navbar.html rename to templates/components/_navbar.html diff --git a/crawler_management.html b/templates/crawler_management.html similarity index 100% rename from crawler_management.html rename to templates/crawler_management.html diff --git a/daily_sales.html b/templates/daily_sales.html similarity index 100% rename from daily_sales.html rename to templates/daily_sales.html diff --git a/dashboard.html b/templates/dashboard.html similarity index 100% rename from dashboard.html rename to templates/dashboard.html diff --git a/edm_dashboard.html b/templates/edm_dashboard.html similarity index 100% rename from edm_dashboard.html rename to templates/edm_dashboard.html diff --git a/growth_analysis.html b/templates/growth_analysis.html similarity index 100% rename from growth_analysis.html rename to templates/growth_analysis.html diff --git a/history.html b/templates/history.html similarity index 100% rename from history.html rename to templates/history.html diff --git a/import.html b/templates/import.html similarity index 100% rename from import.html rename to templates/import.html diff --git a/index.html b/templates/index.html similarity index 100% rename from index.html rename to templates/index.html diff --git a/list.html b/templates/list.html similarity index 100% rename from list.html rename to templates/list.html diff --git a/login.html b/templates/login.html similarity index 100% rename from login.html rename to templates/login.html diff --git a/templates/login_history.html b/templates/login_history.html new file mode 100644 index 0000000..65900e1 --- /dev/null +++ b/templates/login_history.html @@ -0,0 +1,90 @@ +{% extends "base.html" %} + +{% block title %}登入歷史 - WOOO TECH{% endblock %} + +{% block content %} +
+ + +
+
+ 最近記錄 + +
+
+
+ + + + + + + + + + + + + + + + +
時間帳號狀態IP原因User Agent
+
+
+
+
+
+
+{% endblock %} + +{% block extra_js %} + +{% endblock %} diff --git a/maintenance.html b/templates/maintenance.html similarity index 100% rename from maintenance.html rename to templates/maintenance.html diff --git a/monthly_summary_analysis.html b/templates/monthly_summary_analysis.html similarity index 100% rename from monthly_summary_analysis.html rename to templates/monthly_summary_analysis.html diff --git a/sales_analysis.html b/templates/sales_analysis.html similarity index 100% rename from sales_analysis.html rename to templates/sales_analysis.html diff --git a/send_email.html b/templates/send_email.html similarity index 100% rename from send_email.html rename to templates/send_email.html diff --git a/settings.html b/templates/settings.html similarity index 100% rename from settings.html rename to templates/settings.html diff --git a/system_settings.html b/templates/system_settings.html similarity index 100% rename from system_settings.html rename to templates/system_settings.html diff --git a/templates/trends.html b/templates/trends.html new file mode 100644 index 0000000..6e6dc38 --- /dev/null +++ b/templates/trends.html @@ -0,0 +1,135 @@ +{% extends "base.html" %} + +{% block title %}趨勢資料 - WOOO TECH{% endblock %} + +{% block content %} +
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
熱門關鍵字
+
+
+
+
+
+
+
+
趨勢記錄
+
+ + + + + + + + + + + + + +
日期來源分類標題熱度
+
+
+
+
+
+{% endblock %} + +{% block extra_js %} + +{% endblock %} diff --git a/web/templates/brand_assets.html b/web/templates/brand_assets.html deleted file mode 100644 index f7043d2..0000000 --- a/web/templates/brand_assets.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - WOOO TECH 品牌資產庫 - - - - - -
-

WOOO TECH 品牌資產庫

- -
-

1. 主品牌標誌 (Main Logo)

-
-
-
- Main Logo -
-
- SVG (向量)
- -
-
-
-
- Main Logo JPG -
-
- JPG (白底)
- -
-
- -
-
- 其他格式
- -
-
-
-
- -
-

2. 玻璃質感版 (Glass Version)

-
-
-
- Glass Logo -
-
- SVG (向量)
- -
-
-
-
- Glass Logo JPG -
-
- JPG (白底)
- -
-
-
-
- -
-

3. 能量流動版 (Gradient Version)

-
-
-
- Gradient Logo -
-
- SVG (向量)
- -
-
-
-
- Gradient Logo JPG -
-
- JPG (白底)
- -
-
-
-
-
- - - \ No newline at end of file diff --git a/web/templates/growth_analysis.html b/web/templates/growth_analysis.html deleted file mode 100644 index d88b2cd..0000000 --- a/web/templates/growth_analysis.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - 營運成長報表 - MOMO 監控系統 - - - - - - - {% include 'components/_navbar.html' %} - -
-
-

營運成長策略報表

- 數據更新至: {{ chart_data.labels[-1] if chart_data.labels else '-' }} -
- - -
-
-
-
-
YTD 本年度累計業績 ({{ kpi.current_year }})
-
${{ "{:,.0f}".format(kpi.ytd_revenue) }}
-
- YoY Growth - - - {{ "{:+.1f}%".format(kpi.ytd_growth) }} - - vs 去年同期 -
- -
-
-
-
-
-
-
近30天平均客單價 (AOV)
-
${{ "{:,.0f}".format(kpi.recent_aov) }}
-
- 真實訂單基礎 (Unique Order ID) -
- -
-
-
-
-
-
-
總訂單數 (Total Orders)
-
{{ "{:,.0f}".format(kpi.total_orders) }}
-
- 全時期累計 -
- -
-
-
-
- - -
-
-
-
- 月營收與年增率 (Revenue & YoY) -
-
-
- -
-
-
-
-
-
-
- 月增率分析 (MoM) -
-
-
- -
-
-
-
-
- - -
-
-
-
- 客單價趨勢 (AOV Trend) -
-
-
- -
-
-
-
-
-
-
- 獲利能力分析 (Gross Margin %) -
-
-
- -
-
-
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/web/templates/sales_analysis.html b/web/templates/sales_analysis.html deleted file mode 100644 index e69de29..0000000