TravelContentCreator/start_api.py

29 lines
580 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
# -*- coding: utf-8 -*-
"""
TravelContentCreator API 服务启动脚本(简化版)
"""
import sys
import os
from pathlib import Path
# 添加项目根目录到 Python 路径
project_root = Path(__file__).parent / "app"
sys.path.insert(0, str(project_root))
# 设置环境变量
os.environ["PYTHONPATH"] = str(project_root)
# 导入 uvicorn
import uvicorn
if __name__ == "__main__":
# 直接启动 uvicorn指定应用模块
uvicorn.run(
"api.main:app",
host="localhost",
port=8000,
log_level="info"
)