1
tornado.httpserver 輸入HTTPServerの から tornado.routing 輸入RuleRouter、ルール、PathMatches から tornado.web 輸入のRequestHandler、アプリケーション から tornado.ioloopの輸入IOLoop クラスHandler1(のRequestHandler): デフ(自己)を取得: self.write(' 1 ' ) クラスHandler2(要請ハンドラ): DEF 得る(自己): self.write(' 2 ' ) APP1 = 応用([ (R" / APP1 /ハンドラ" 、Handler1)、 #他のハンドラ... ]) APP2 = 応用([ (R " / APP2 /ハンドラ" 、Handler2)、 #他のハンドラ... ]) ルータ = RuleRouter([ ルール( PathMatches(" /app1.* " )、APP1)、 規則(PathMatches(" /app2.* " )、APP2) ]) の場合 __name__ == ' __main__ ' : サーバー = 8888 HTTPServerの(ルータ) server.listen( ) IOLoop.current()。()を起動します