您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import sys
  2. def is_db_command():
  3. if len(sys.argv) > 1 and sys.argv[0].endswith("flask") and sys.argv[1] == "db":
  4. return True
  5. return False
  6. # create app
  7. if is_db_command():
  8. from app_factory import create_migrations_app
  9. app = create_migrations_app()
  10. else:
  11. # It seems that JetBrains Python debugger does not work well with gevent,
  12. # so we need to disable gevent in debug mode.
  13. # If you are using debugpy and set GEVENT_SUPPORT=True, you can debug with gevent.
  14. # if (flask_debug := os.environ.get("FLASK_DEBUG", "0")) and flask_debug.lower() in {"false", "0", "no"}:
  15. # from gevent import monkey
  16. #
  17. # # gevent
  18. # monkey.patch_all()
  19. #
  20. # from grpc.experimental import gevent as grpc_gevent # type: ignore
  21. #
  22. # # grpc gevent
  23. # grpc_gevent.init_gevent()
  24. # import psycogreen.gevent # type: ignore
  25. #
  26. # psycogreen.gevent.patch_psycopg()
  27. from app_factory import create_app
  28. app = create_app()
  29. celery = app.extensions["celery"]
  30. if __name__ == "__main__":
  31. app.run(host="0.0.0.0", port=5001)