截图识别飞书个人任务清单
This commit is contained in:
71
start_web_app.py
Normal file
71
start_web_app.py
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
启动Screen2Feishu Web应用
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import webbrowser
|
||||
from pathlib import Path
|
||||
|
||||
def main():
|
||||
"""启动Web应用"""
|
||||
print("=" * 60)
|
||||
print("Screen2Feishu Web应用启动器")
|
||||
print("=" * 60)
|
||||
|
||||
# 检查依赖
|
||||
print("检查依赖...")
|
||||
try:
|
||||
import flask
|
||||
import flask_cors
|
||||
print("✓ Flask 已安装")
|
||||
print("✓ Flask-CORS 已安装")
|
||||
except ImportError as e:
|
||||
print(f"✗ 缺少依赖: {str(e)}")
|
||||
print("请运行: pip install flask flask-cors")
|
||||
return 1
|
||||
|
||||
# 检查配置文件
|
||||
config_path = Path("config.yaml")
|
||||
if not config_path.exists():
|
||||
print("✗ 配置文件不存在: config.yaml")
|
||||
print("请复制 config.example.yaml 为 config.yaml 并配置")
|
||||
return 1
|
||||
|
||||
# 检查必要的目录
|
||||
directories = ["monitor_images", "processed_images", "data", "templates"]
|
||||
for directory in directories:
|
||||
Path(directory).mkdir(exist_ok=True)
|
||||
|
||||
# 检查模板文件
|
||||
template_path = Path("templates/index.html")
|
||||
if not template_path.exists():
|
||||
print("✗ 模板文件不存在: templates/index.html")
|
||||
print("请确保模板文件已创建")
|
||||
return 1
|
||||
|
||||
print("✓ 所有检查通过")
|
||||
print()
|
||||
|
||||
# 启动Web服务器
|
||||
print("启动Web服务器...")
|
||||
print("服务器地址: http://localhost:5000")
|
||||
print("按 Ctrl+C 停止服务器")
|
||||
print()
|
||||
|
||||
try:
|
||||
# 启动Flask应用
|
||||
subprocess.run([sys.executable, "web_app.py"])
|
||||
except KeyboardInterrupt:
|
||||
print("\n服务器已停止")
|
||||
except Exception as e:
|
||||
print(f"启动失败: {str(e)}")
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user