嘗試首次安裝Tornado(在EC2 Linux實例上)。我做無法導入Tornado子模塊
pip install tornado
,然後試圖運行Hello World示例:http://www.tornadoweb.org/en/stable/#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(80)
tornado.ioloop.IOLoop.instance().start()
然後我嘗試:
python hello.py
,但得到:
謝謝琥珀,我很笨 – Yarin
如何停止服務器。我也試過你好世界的例子。但我不知道如何阻止它 –
嘗試'Ctrl + C'來停止它。 – Amber