【发布时间】:2014-05-21 08:44:57
【问题描述】:
我们来看看 Tornado 主页中的 hello world 应用:
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
有没有办法,在 IOloop 启动并且不停止它之后,基本上停止应用程序并启动另一个应用程序(在同一个端口或另一个端口上)?
我看到我可以在运行时添加新的应用程序(侦听不同的端口),但我不知道如何停止现有的应用程序。
【问题讨论】: