Boaz
Boaz

Reputation: 5084

pass arguments to `before_first_request_funcs` in flask

I want the function I pass to before_first_request_funcs the ability to access app.config object.
Can I pass an argument to the function somehow?
Access the "current app object" (it is not really global and I can just access it, right?)

Upvotes: 0

Views: 362

Answers (1)

iurisilvio
iurisilvio

Reputation: 4987

Yes, just access the current_app. This is the way to do it. The before_first_request callback run inside the app context.

Upvotes: 2

Related Questions