app.py 658 B

123456789101112131415161718192021222324252627282930
  1. from libs import version_utils
  2. # preparation before creating app
  3. version_utils.check_supported_python_version()
  4. def is_db_command():
  5. import sys
  6. if len(sys.argv) > 1 and sys.argv[0].endswith("flask") and sys.argv[1] == "db":
  7. return True
  8. return False
  9. # create app
  10. if is_db_command():
  11. from app_factory import create_migrations_app
  12. app = create_migrations_app()
  13. else:
  14. from app_factory import create_app
  15. from libs import threadings_utils
  16. threadings_utils.apply_gevent_threading_patch()
  17. app = create_app()
  18. celery = app.extensions["celery"]
  19. if __name__ == "__main__":
  20. app.run(host="0.0.0.0", port=5001)