Remove deprecated files and scripts related to cron jobs and WeChat server functionality. Update README to include new server startup methods using uWSGI and Gunicorn. Ensure callback server configuration is loaded properly in production environments. Clean up unnecessary test scripts and example files to streamline the project structure.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
企业微信回调服务器启动脚本
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 添加项目路径
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
|
||||
try:
|
||||
from gx_gp_monitor.wechat.callback_server import get_callback_server
|
||||
from gx_gp_monitor.core.config_manager import load_config
|
||||
from gx_gp_monitor.core.logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
def main():
|
||||
"""启动企业微信回调服务器"""
|
||||
# 加载配置
|
||||
config = load_config()
|
||||
|
||||
# 获取回调服务器
|
||||
callback_server = get_callback_server()
|
||||
|
||||
# 启动服务器
|
||||
host = '0.0.0.0'
|
||||
port = 18001
|
||||
debug = config.debug if config else False
|
||||
|
||||
logger.info(f"启动企业微信回调服务器: {host}:{port}")
|
||||
print(f"启动企业微信回调服务器: {host}:{port}")
|
||||
print("回调地址: /api/v1/wechat/callback")
|
||||
callback_server.run(host=host, port=port, debug=debug)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
except ImportError as e:
|
||||
print(f"导入失败: {e}", file=sys.stderr)
|
||||
print("请确保已安装所有依赖: pip install -r gx_gp_monitor/requirements.txt", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"启动失败: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user