修正廠商模板載入優先序
All checks were successful
CD Pipeline / deploy (push) Successful in 56s

This commit is contained in:
OoO
2026-05-14 00:00:46 +08:00
parent cc2b1f576c
commit 4418599f46
2 changed files with 10 additions and 1 deletions

9
app.py
View File

@@ -30,6 +30,7 @@ except OSError as e:
# ================= 🔧 2. 核心模組導入 =================
try:
from flask import Flask, render_template, jsonify, request, send_file, redirect, url_for, send_from_directory, flash, session
from jinja2 import ChoiceLoader, FileSystemLoader
from werkzeug.utils import secure_filename
from pyngrok import ngrok, conf
import schedule
@@ -127,6 +128,7 @@ else:
sys_log.warning("[Security] ⚠️ NGROK_AUTH_TOKEN 未設定,已跳過 ngrok auth token 注入")
TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates')
WEB_TEMPLATE_DIR = os.path.join(BASE_DIR, 'web/templates')
STATIC_DIR = os.path.join(BASE_DIR, 'web/static')
# 檢查關鍵模板是否存在
@@ -137,6 +139,13 @@ app = Flask(__name__,
template_folder=TEMPLATE_DIR,
static_folder=STATIC_DIR)
if os.path.isdir(WEB_TEMPLATE_DIR):
# Keep newer module templates ahead of stale legacy copies that may exist on older hosts.
app.jinja_loader = ChoiceLoader([
FileSystemLoader(WEB_TEMPLATE_DIR),
app.jinja_loader,
])
# ==========================================
# 🔒 Flask 安全配置
# ==========================================

View File

@@ -320,7 +320,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
SYSTEM_VERSION = "V10.142"
SYSTEM_VERSION = "V10.143"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示