From ed8c037109cdbc0470045180c8232ea68272b6aa Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 15 Mar 2015 15:47:04 +0100 Subject: [PATCH] redirect index --- eventman_server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eventman_server.py b/eventman_server.py index b8db6e1..ee8b981 100755 --- a/eventman_server.py +++ b/eventman_server.py @@ -13,10 +13,12 @@ from tornado.options import define, options import tornado.web from tornado import gen -class MainHandler(tornado.web.RequestHandler): +class RootHandler(tornado.web.RequestHandler): + angular_app_path = os.path.join(os.path.dirname(__file__), "angular_app") @gen.coroutine def get(self): - self.redirect('/index.html') + with open(self.angular_app_path + "/index.html", 'r') as fd: + self.write(fd.read()) MOCKUP_PERSONS = [ {'name': 'Silvia', 'surname': 'Castellari', @@ -46,7 +48,7 @@ def main(): application = tornado.web.Application([ (r"/persons/?(?P\d+)?", PersonsHandler), - (r"/", MainHandler), + (r"/(?:index.html)?", RootHandler), (r'/(.*)', tornado.web.StaticFileHandler, {"path": "angular_app"}) ], template_path=os.path.join(os.path.dirname(__file__), "templates"),