main.py 774 B

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