2026-07-30 10:30:50 +08:00
|
|
|
|
"""
|
|
|
|
|
|
moldinsight 入口 — 使用 shared.app_factory.create_app() 构建
|
|
|
|
|
|
"""
|
2026-05-29 18:19:30 +08:00
|
|
|
|
import os, sys
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
src_root = Path(__file__).parent.parent
|
|
|
|
|
|
sys.path.insert(0, str(src_root))
|
|
|
|
|
|
|
|
|
|
|
|
os.chdir(Path(__file__).parent.parent.parent)
|
|
|
|
|
|
|
2026-07-30 10:30:50 +08:00
|
|
|
|
from shared.app_factory import create_app
|
2026-05-29 18:19:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-07-30 10:30:50 +08:00
|
|
|
|
def _register_routers(app):
|
|
|
|
|
|
"""注册 moldinsight 业务路由"""
|
2026-05-29 18:19:30 +08:00
|
|
|
|
try:
|
2026-07-30 10:30:50 +08:00
|
|
|
|
from moldinsight.api import router as moldinsight_router
|
|
|
|
|
|
app.include_router(moldinsight_router, prefix="/api")
|
2026-05-29 18:19:30 +08:00
|
|
|
|
except Exception as e:
|
2026-07-30 10:30:50 +08:00
|
|
|
|
print(f"[WARN] MoldInsight 路由: {e}")
|
2026-05-29 18:19:30 +08:00
|
|
|
|
|
2026-09-18 17:22:01 +08:00
|
|
|
|
# D11:HTML 报告代理挂根路径,URL 形状与原 StaticFiles 保持一致(/html/{filename})
|
|
|
|
|
|
try:
|
|
|
|
|
|
from moldinsight.api.html_report_router import include_into as include_html_report
|
|
|
|
|
|
include_html_report(app)
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
print(f"[WARN] HTML 报告路由: {e}")
|
|
|
|
|
|
|
2026-05-29 18:19:30 +08:00
|
|
|
|
|
2026-07-30 10:30:50 +08:00
|
|
|
|
app = create_app(
|
|
|
|
|
|
title="Gemold - 模具分析引擎",
|
|
|
|
|
|
service_name="moldinsight",
|
2026-09-18 17:22:01 +08:00
|
|
|
|
connect_rustfs=True,
|
2026-08-31 18:01:34 +08:00
|
|
|
|
serve_frontend_static=False,
|
2026-07-30 10:30:50 +08:00
|
|
|
|
register_routers=_register_routers,
|
|
|
|
|
|
)
|