trading.ai/start_web.py
2025-09-18 20:45:01 +08:00

44 lines
999 B
Python

#!/usr/bin/env python3
"""
启动A股量化交易系统Web界面
"""
import sys
import subprocess
from pathlib import Path
import webbrowser
import time
def main():
"""启动Web服务"""
print("🌐 A股量化交易系统")
print("=" * 50)
# 检查web目录
web_dir = Path(__file__).parent / "web"
if not web_dir.exists():
print("❌ web目录不存在")
return
app_file = web_dir / "app.py"
if not app_file.exists():
print("❌ app.py文件不存在")
return
print("🚀 启动Flask服务器...")
print("📊 访问地址: http://localhost:8080")
print("⏹️ 按 Ctrl+C 停止服务")
print("=" * 50)
try:
# 启动Flask应用
subprocess.run([
sys.executable, str(app_file)
], cwd=str(web_dir))
except KeyboardInterrupt:
print("\n👋 服务已停止")
except Exception as e:
print(f"❌ 启动失败: {e}")
if __name__ == "__main__":
main()