From 560cdb44c04d3201b50645fab4e84796d2cc47ba Mon Sep 17 00:00:00 2001 From: Pine Date: Mon, 24 Aug 2026 17:32:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(server-core):=20main.py=20=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E6=94=B9=E8=B5=B0=20dispatcher:app=20=E2=80=94=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20/park=20=E4=B8=8E=20/api(=E5=9F=B9?= =?UTF-8?q?=E8=AE=AD)=20=E5=AD=90=E5=BA=94=E7=94=A8=20404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原 main.py 直接运行 app.main:app(仅平台应用),/park、/api(培训) 未路由所以 404; 改为运行 dispatcher:app(统一入口,含 app.main + app.training + app.park), 等价 uvicorn dispatcher:app --port 8090。'uv run main.py' 即可完整启动。 --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 97d7277..8e25f77 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,10 @@ -from app.main import app +"""server-core 本地启动入口。 + +必须用 dispatcher:app(统一入口)而非 app.main:app,否则 /park、/api(培训) 子应用 +不会被路由。等价命令:uv run uvicorn dispatcher:app --host 0.0.0.0 --port 8090 +""" +from dispatcher import app import uvicorn if __name__ == "__main__": - uvicorn.run(app, host="127.0.0.1", port=8090) \ No newline at end of file + uvicorn.run(app, host="0.0.0.0", port=8090) \ No newline at end of file