Forum Discussion
fillmore
2 years agoNew Contributor
So, here is my solution, in case it's useful to others. I added the heavy duty part to the __main__.py file and then made it accessible to models and controllers through the app context:
heavy = ... real heavy, gets computed once a t startup
def main():
:
with app.app.app_context():
current_app.heavy = heavy
Controller methods can access the heavy stuff with:
with current_app.app_context():
heavy = current_app.heavy
If there is a better way to do it, please let me know. This cuts it for me.
PS: thank you Hans for your suggestion. Didn't work for me.
Related Content
- 3 years ago
- 2 years ago
- 3 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 19 days ago