main.py 609 B

123456789101112131415161718192021222324
  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 app import HBlogFlask
  13. from waitress import serve
  14. app = HBlogFlask(__name__)
  15. if conf["server-name"] is not None:
  16. app.config['SERVER_NAME'] = conf["server-name"]
  17. if __name__ == '__main__':
  18. logging.info("Server start on 127.0.0.1:8080")
  19. serve(app, host='0.0.0.0', port="8080")