Blame view

handlers/index.py 629 Bytes
c4176e46d   zhuzhenchao   add file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  # 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')