flask-executor
flask-executor copied to clipboard
Can't be run outside of scope?
Why you have to bind it to a route?
RuntimeError: This decorator can only be used at local scopes when a request context is on the stack. For instance within view functions.
Same here:
"This decorator can only be used at local scopes "
RuntimeError: This decorator can only be used at local scopes when a request context is on the stack. For instance within view functions.
You actually can run outside of a route. Ugly but works
with app.test_request_context():
executor.submit(...)
Wouldn't call that ugly, I'd call that the standard expectation for every Flask extension. Could add some kind of workaround parameter but there are enough "how do I run Flask-related things outside of a request context?" questions on the internet that I'm not convinced a bespoke solution is warranted.