From 2310b7a173326b9680a29a41bb575a620a2e574a Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 14 Mar 2015 13:05:04 +0100 Subject: [PATCH] handle index.html --- eventman_server.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eventman_server.py b/eventman_server.py index 4f2831f..6b68e0f 100755 --- a/eventman_server.py +++ b/eventman_server.py @@ -11,11 +11,13 @@ import tornado.ioloop import tornado.options from tornado.options import define, options import tornado.web +from tornado import gen class MainHandler(tornado.web.RequestHandler): + @gen.coroutine def get(self): - self.write("Hello, world") + self.redirect('/static/html/index.html') def main(): @@ -26,12 +28,11 @@ def main(): tornado.options.parse_command_line() application = tornado.web.Application([ - (r"/", MainHandler), + (r"/(?:index.html)?", MainHandler), ], + template_path=os.path.join(os.path.dirname(__file__), "templates"), static_path=os.path.join(os.path.dirname(__file__), "static"), - debug=options.debug - ) - + debug=options.debug) http_server = tornado.httpserver.HTTPServer(application) http_server.listen(options.port) tornado.ioloop.IOLoop.instance().start()