29 lines
885 B
Python
Raw Permalink 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 uvicorn
import argparse
import logging
if __name__ == "__main__":
# 配置命令行参数
parser = argparse.ArgumentParser(description="TravelContentCreator API服务")
parser.add_argument("--host", default="0.0.0.0", help="监听主机地址")
parser.add_argument("--port", type=int, default=8000, help="监听端口")
parser.add_argument("--reload", action="store_true", help="是否启用热重载")
parser.add_argument("--log-level", default="info", help="日志级别")
args = parser.parse_args()
# 启动服务
print(f"启动API服务地址: {args.host}:{args.port}")
uvicorn.run(
"api.main:app",
host=args.host,
port=args.port,
reload=args.reload,
log_level=args.log_level
)