diff --git a/CHANGES.rst b/CHANGES.rst index 01a0232e..bd2df1db 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,7 @@ Changelog Release date: - - Upgrade to Bootstrap 5.3.1 and Bootswatch 5.3.1 +- Replaced deprecated Flask decorator before_first_request 2.3.0 diff --git a/examples/bootstrap4/app.py b/examples/bootstrap4/app.py index 6ed80a0d..ac7e7207 100644 --- a/examples/bootstrap4/app.py +++ b/examples/bootstrap4/app.py @@ -137,8 +137,7 @@ class Message(db.Model): create_time = db.Column(db.Integer, nullable=False, unique=True) -@app.before_first_request -def before_first_request_func(): +with app.app_context(): db.drop_all() db.create_all() for i in range(20): diff --git a/examples/bootstrap5/app.py b/examples/bootstrap5/app.py index af1e8259..60f9d7fb 100644 --- a/examples/bootstrap5/app.py +++ b/examples/bootstrap5/app.py @@ -141,8 +141,7 @@ class Message(db.Model): create_time = db.Column(db.Integer, nullable=False, unique=True) -@app.before_first_request -def before_first_request_func(): +with app.app_context(): db.drop_all() db.create_all() for i in range(20):