I am trying to start a new thread in Python inside of a Flask application. I am doing background work that gets triggered by the request, but I don\'t need to wait for the
You can copy the desired info and pass it on:
@app.route('/my_endpoint', methods=['POST'])
def my_endpoint_handler():
#do tracking in sub-thread so we don't hold up the page
def handle_sub_view(data):
# Use the data in subprocess
data = request.get_json() # copy the data
thread.start_new_thread(handle_sub_view, data)
return "Thanks"