main.py 622 B

12345678910111213141516171819202122232425
  1. from configure import configure, conf
  2. import os
  3. import logging
  4. env_dict = os.environ
  5. hblog_conf = env_dict.get("hblog_conf")
  6. if hblog_conf is None:
  7. logging.info("Configure file ./etc/conf.json")
  8. configure("./etc/conf.json")
  9. else:
  10. logging.info(f"Configure file {hblog_conf}")
  11. configure(hblog_conf)
  12. from view import WebApp
  13. from waitress import serve
  14. web = WebApp(__name__)
  15. app = web.get_app()
  16. if conf["server-name"] is not None:
  17. app.config['SERVER_NAME'] = conf["server-name"]
  18. if __name__ == '__main__':
  19. logging.info("Server start on 127.0.0.1:8080")
  20. serve(app, host='0.0.0.0', port="8080")