Run Code Before the First Request in Flask
To run some code (once) before the first request in a Flask app, you could use the before_first_request decorator. However, since it's deprecation in Flask 2.3.0.
The recommended way is to use it after app config by manually pushing the app context, like so: