Python Flask shutdown event handler
There is no app.stop() if that is what you are looking for, however using module atexit you can do something similar: https://docs.python.org/2/library/atexit.html Consider this: import atexit #defining function to run on shutdown def close_running_threads(): for thread in the_threads: thread.join() print “Threads complete, ready to finish” #Register the function to be called on exit atexit.register(close_running_threads) #start … Read more