Working outside of request context. This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem. code example
Example: raise RuntimeError(_request_ctx_err_msg) RuntimeError: Working outside of request context
@app.route('/my_endpoint', methods=['POST'])
def my_endpoint_handler():
def handle_sub_view(req):
with app.test_request_context():
from flask import request
request = req
thread.start_new_thread(handle_sub_view, (request))
return "Thanks"