如果你要查找的是没有app.stop(),但是使用模块
atexit可以执行类似的操作:
https://docs.python.org/2/library/atexit.html
考虑一下:
import atexit#defining function to run on shutdowndef close_running_threads(): for thread in the_threads: thread.join() print "Threads complete, ready to finish"#Register the function to be called on exitatexit.register(close_running_threads)#start your processapp.run()
另外,
atexit如果你使用
Ctrl-C强制关闭服务器,则不会调用。
为此,还有另一个模块-
signal。



