Files
sanguo_vnpy_v2/run_web.py
T

32 lines
945 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
Sanguo VeighNa Web API 启动脚本
"""
import sys
import os
# 添加项目根目录到 Python 路径
project_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_dir)
# 添加 vnpy_v4.4.0 到 Python 路径
vnpy_dir = os.path.join(project_dir, "vnpy_v4.4.0")
if os.path.exists(vnpy_dir):
sys.path.insert(0, vnpy_dir)
print(f"Added vnpy_v4.4.0 to Python path: {vnpy_dir}")
if __name__ == "__main__":
import uvicorn
# Phase 3b 起:研究/回测 API sanguo_api(工厂模式,读 config/backtest.yaml
# 单进程(uvicorn.run 默认 workers=1)——orchestrator 任务状态在内存,必须单进程。
# 端口 8000 不变(vnpy.mysanguo.top 外网绑定依赖)。
uvicorn.run(
"sanguo_api.main:create_app",
factory=True,
host="0.0.0.0",
port=8000,
reload=False, # 生产模式
log_level="info"
)