#!/usr/bin/env python3 """ 以调试模式启动API服务器,包含详细日志输出 """ import subprocess import sys import os def start_api_debug(): """启动API服务器(调试模式)""" print("启动API服务器(调试模式)...") print("="*60) # 切换到正确的目录 os.chdir(os.path.dirname(__file__)) # 启动命令 cmd = [ sys.executable, "./server/api.py", "--debug", "--host", "0.0.0.0", "--port", "5000" ] print(f"执行命令: {' '.join(cmd)}") print("="*60) try: # 直接运行,输出会实时显示 result = subprocess.run(cmd) print(f"API服务器退出,退出码: {result.returncode}") except KeyboardInterrupt: print("\n收到中断信号,停止API服务器") except Exception as e: print(f"启动API服务器失败: {e}") if __name__ == "__main__": start_api_debug()