main.py 550 B

123456789101112131415161718192021222324252627
  1. from configure import configure
  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 HTalkFlask
  13. app = HTalkFlask(__name__)
  14. @app.shell_context_processor
  15. def make_shell_context():
  16. from app.db import db, create_all
  17. return {
  18. "app": app,
  19. "db": db,
  20. "create_all": create_all
  21. }