# coding: utf-8 import tornado.web class BaseHandler(tornado.web.RequestHandler): def __init__(self, *args, **kwargs): super(BaseHandler, self).__init__(*args, **kwargs) x_real_ip = self.request.headers.get("X-Real-IP") self.remote_ip = self.request.remote_ip if not x_real_ip else x_real_ip def render(self, template_name, **kwargs): super(BaseHandler, self).render(template_name, **kwargs) class IndexHandler(BaseHandler): def get(self): return self.render('index.html') class WebAppHandler(BaseHandler): def get(self): return self.render('webapp.html')