Flask-SQLAlchemy只需要一个应用程序上下文即可运行。您可以手动创建应用上下文。
app = create_app(env)ctx = app.app_context()ctx.push()# your pre herectx.pop()
这来自这里和这里的文档。

Flask-SQLAlchemy只需要一个应用程序上下文即可运行。您可以手动创建应用上下文。
app = create_app(env)ctx = app.app_context()ctx.push()# your pre herectx.pop()
这来自这里和这里的文档。