How do I stop Tornado web server?

后端 未结 9 677
渐次进展
渐次进展 2020-12-08 06:48

I\'ve been playing around a bit with the Tornado web server and have come to a point where I want to stop the web server (for example during unit testing). The following sim

9条回答
  •  时光取名叫无心
    2020-12-08 07:29

    In case you do no want to bother with threads, you could catch a keyboard interrupt signal :

    try:
        tornado.ioloop.IOLoop.instance().start()
    # signal : CTRL + BREAK on windows or CTRL + C on linux
    except KeyboardInterrupt:
        tornado.ioloop.IOLoop.instance().stop()
    

提交回复
热议问题