import sys from pathlib import Path # 添加项目根目录到 Python 路径 current_file = Path(__file__).resolve() project_root = current_file.parent.parent if str(project_root) not in sys.path: sys.path.insert(0, str(project_root)) import uvicorn from app.app_factory import create_app from app.core.config import API_CONFIG app = create_app() if __name__ == "__main__": uvicorn.run( "app.main:app", host=API_CONFIG['host'], port=API_CONFIG['port'], limit_max_requests=1000, timeout_keep_alive=30, reload=True, )