📅  最后修改于: 2022-03-11 14:46:08.250000             🧑  作者: Mango
#Push an application context when running db.create_all()
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'My connection string'
db.init_app(app)
# Add the with statement below to encapsulate db.create_all()
with app.app_context():
db.create_all()