main.py 827 B

123456789101112131415161718192021222324252627282930313233
  1. # from app import generate_app
  2. # app = generate_app()
  3. import traceback
  4. from app import generate_app
  5. # import uvicorn
  6. app = generate_app()
  7. def main():
  8. try:
  9. # 定时任务
  10. from lib.JobManage import JobManage
  11. JobManage.run()
  12. # 监听mqtt消息服务
  13. from lib.MessageListener import MessageListener
  14. MessageListener.run(background_is=True)
  15. # 给websocket发数据的
  16. # from factories.line_manage import LineManage
  17. # LineManage.run_background()
  18. # websocket服务 与 api服务
  19. app.run(address='0.0.0.0', port=5042, debug=True)
  20. except Exception as exception:
  21. print(f'main23: {exception.__class__.__name__}', flush=True)
  22. print(f'main23: {traceback.format_exc()}', flush=True)
  23. if __name__ == '__main__':
  24. main()