ComfyUI-WorkflowPublisher/run_service.py

36 lines
1017 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
"""
启动脚本 - 从项目根目录运行 workflow_service
"""
import sys
import os
from pathlib import Path
# 加载 .env 文件
try:
from dotenv import load_dotenv
env_path = Path(__file__).parent / ".env"
load_dotenv(env_path)
print(f"已加载环境变量文件: {env_path}")
except ImportError:
print("警告: 未安装 python-dotenv无法加载 .env 文件")
except Exception as e:
print(f"警告: 加载 .env 文件失败: {e}")
# 将项目根目录添加到Python路径
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
# 现在可以正常导入
from app.main import web_app
import uvicorn
print("🚀 启动 ComfyUI 工作流服务监控...")
print("📊 监控页面地址: http://localhost:18000/monitor")
print("🔍 健康检查: http://localhost:18000/monitor/health")
print("📈 API 文档: http://localhost:18000/docs")
if __name__ == "__main__":
uvicorn.run(web_app, host="0.0.0.0", port=18000)