我让flask在wsgiserver上运行。它是从以下内容开始的。
d = wsgiserver.WSGIPathInfoDispatcher({'/': app})
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 7000), d)
if __name__ == '__main__':
try:
server.start()
except KeyboardInterrupt:
server.stop()我怎么才能阻止它?所以..。
@app.route('/stop')
@requires_auth
def stop():
CODE TO STOP HERE我到处搜索谷歌,没有找到任何有用的东西。请找人帮忙。谢谢
发布于 2012-04-11 21:30:42
您应该能够这样做:
def run():
d = wsgiserver.WSGIPathInfoDispatcher({'/': app})
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 7000), d)
@app.route('/stop')
@requires_auth
def stop():
server.stop()
try:
server.start()
except KeyboardInterrupt:
server.stop()
if __name__ == '__main__':
run()https://stackoverflow.com/questions/9965891
复制相似问题