Blueprint before_app_first_request vs record_once usage discrepancy #5166
-
I'm working on upgrading from Flask 2.2.x to 2.3.x and I use the .before_app_first_request decorator in one of my blueprints. Following the deprecation warning, I replaced .before_app_first_request with .record_once and it was not a drop-in replacement. Not sure if this an issue in code implementation or unclear documentation.
replace .before_app_first_request with .record_once and it will no longer run Environment:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
See the documentation for @blueprint.record_once
def my_test_function(state):
state.app.logger.info("testing") |
Beta Was this translation helpful? Give feedback.
-
Thank you for the very fast response. I didn't read through the documentation far enough. |
Beta Was this translation helpful? Give feedback.
See the documentation for
record_once
andrecord
: https://flask.palletsprojects.com/en/2.3.x/api/#flask.Blueprint.record. The decorated function takes astate
argument.