Beispiel #1
0
 def __init__(self):
     handlers = [
         (r'/(.*?\.html)$', PageHandler),
         # in product environment, use nginx to support static resources
         # (r'/(.*\.(?:css|jpg|png|js|ico|json))$', tornado.web.StaticFileHandler, 
         #  {'path':TEMPLATE_PATH}),
         # (r'/test', TestHandler),
         (r'/project', ProjectHandler),
         (r'/file', FileHandler),
         (r'/message/(.*)/', MessageHandler),
         (r'/', MainHandler),
     ]
     settings = {
         'cookie_secret':util.sha1('niot').hexdigest(), 
         'static_path':TEMPLATE_PATH,
         # 'static_url_prefix':'resource/',
         'debug':False,
         'autoreload':True,
         'autoescape':'xhtml_escape',
         'i18n_path':os.path.join(CURRENT_PATH, 'resource/i18n'),
         # 'login_url':'',
         'xheaders':True,    # use headers like X-Real-IP to get the user's IP address instead of
                             # attributeing all traffic to the balancer's IP address.
     }
     super(Application, self).__init__(handlers, **settings)
Beispiel #2
0
 def __init__(self):
     handlers = [
         (r'/(.*?\.html)$', PageHandler),
         # in product environment, use nginx to support static resources
         # (r'/(.*\.(?:css|jpg|png|js|ico|json))$', tornado.web.StaticFileHandler,
         #  {'path':TEMPLATE_PATH}),
         # (r'/test', TestHandler),
         (r'/project', ProjectHandler),
         (r'/file', FileHandler),
         (r'/message/(.*)/', MessageHandler),
         (r'/', MainHandler),
     ]
     settings = {
         'cookie_secret': util.sha1('niot').hexdigest(),
         'static_path': TEMPLATE_PATH,
         # 'static_url_prefix':'resource/',
         'debug': False,
         'autoreload': True,
         'autoescape': 'xhtml_escape',
         'i18n_path': os.path.join(CURRENT_PATH, 'resource/i18n'),
         # 'login_url':'',
         'xheaders':
         True,  # use headers like X-Real-IP to get the user's IP address instead of
         # attributeing all traffic to the balancer's IP address.
     }
     super(Application, self).__init__(handlers, **settings)
Beispiel #3
0
    def __init__(self):
        handlers = [
            (r'/account/(.*?)/bind', BindHandler),
            (r'/account/?(.*)$', AccountHandler),
            # (r'/m_web/(.*)', WeiXinViewHandler),
            (r'/(.*?\.html)$', PageHandler),
            (r'/stat$', StatHandler),
            # in product environment, use nginx to support static resources
            # (r'/(.*\.(?:css|jpg|png|js|ico|json))$', tornado.web.StaticFileHandler, 
            #  {'path':TEMPLATE_PATH}),
            # (r'/weixin$', WeiXinHandler),

            # register account
            (r'/register', RegisterHandler),

            # check version
            (r'/version', VersionHandler),

            # get mobile verify code
            (r'/mobile/(.*)/(.*)$', NotifyHandler),
            (r'/mobile$', MobileHandler),
            (r'/sms$', SmsHandler),

            # pns operator
            (r'/pns/', PNSHandler),

            # check ssid property
            (r'/ssid/(.*)$', WIFIHandler),
            (r'/cid/(.*)$', CIDHandler),

            (r'/portal/user$', PortalHandler),

            # nansha interface
            # (r'/ns/manager', NSManagerHandler),
            # add/update/delete nansha employee
            # (r'/pn/(.*?)/(.*)$', PNAccountHandler),
            # (r'/pn/?(.*)$', PNHolderHandler),

            # group interface
            (r'/', MainHandler),
        ]
        settings = {
            'cookie_secret':util.sha1('bidong').hexdigest(), 
            'static_path':STATIC_PATH,
            # 'static_url_prefix':'resource/',
            'debug':False,
            'autoreload':True,
            'autoescape':'xhtml_escape',
            'i18n_path':os.path.join(STATIC_PATH, 'i18n'),
            # 'login_url':'',
            'xheaders':True,    # use headers like X-Real-IP to get the user's IP address instead of
                                # attributeing all traffic to the balancer's IP address.
        }
        super(Application, self).__init__(handlers, **settings)
Beispiel #4
0
    def check_signature(self, serve):
        '''
            all request must be check request's issuer
        '''
        signature = self.get_argument('signature')
        timestamp = self.get_argument('timestamp')
        nonce = self.get_argument('nonce')

        token = WEIXIN_CONFIG[serve]['token']

        sha1 = util.sha1(''.join(sorted([token, timestamp, nonce])))
        if signature != sha1.hexdigest():
            raise HTTPError(400)
Beispiel #5
0
 def __init__(self):
     handlers = [
         (r'/', IMHandler),
         (r'/notify', NotifyHandler),
     ]
     settings = {
         'cookie_secret':util.sha1('ims').hexdigest(), 
         # 'static_path':CURRENT_PATH,
         # 'static_url_prefix':'resource/',
         'debug':False,
         'autoreload':True,
         'autoescape':'xhtml_escape',
         # 'i18n_path':os.path.join(CURRENT_PATH, 'resource/i18n'),
         # 'login_url':'',
         'xheaders':True,    # use headers like X-Real-IP to get the user's IP address instead of
                             # attributeing all traffic to the balancer's IP address.
     }
     super(Application, self).__init__(handlers, **settings)
Beispiel #6
0
    def __init__(self):
        handlers = [
            (r'/account/(.*?)/bind', BindHandler),
            (r'/account/(.*)/$', AccountHistoryHandler),
            (r'/account/?(.*)$', AccountHandler),
            (r'/wx/m_(.*?)/(.*)$', WeiXinViewHandler),
            (r'/wx/?(.*)$', WeiXinHandler),
            (r'/(getdbi)\.html$', FactoryHandler),
            (r'/(.*?\.html)$', PageHandler),
            # in product environment, use nginx to support static resources
            # (r'/(.*\.(?:css|jpg|png|js|ico|json))$', tornado.web.StaticFileHandler, 
            #  {'path':TEMPLATE_PATH}),
            (r'/holder/(.*)/ap$', APHandler),
            (r'/holder/(.*)/room$', RoomHandler),
            (r'/holder/?(.*)$', HolderHandler),
            (r'/manager/?(.*)$', ManagerHandler),

            # register account
            (r'/register', RegisterHandler),

            # check version
            (r'/version', VersionHandler),

            (r'/', MainHandler),
        ]
        settings = {
            'cookie_secret':util.sha1('bidong').hexdigest(), 
            'static_path':TEMPLATE_PATH,
            # 'static_url_prefix':'resource/',
            'debug':False,
            'autoreload':True,
            'autoescape':'xhtml_escape',
            'i18n_path':os.path.join(STATIC_PATH, 'i18n'),
            # 'login_url':'',
            'xheaders':True,    # use headers like X-Real-IP to get the user's IP address instead of
                                # attributeing all traffic to the balancer's IP address.
        }
        super(Application, self).__init__(handlers, **settings)
Beispiel #7
0
 def __init__(self):
     handlers = [
         (r"/(.*?\.html)$", PageHandler),
         # in product environment, use nginx to support static resources
         # (r'/(.*\.(?:css|jpg|png|js|ico|json))$', tornado.web.StaticFileHandler,
         #  {'path':TEMPLATE_PATH}),
         # (r'/test', TestHandler),
         (r"/project", ProjectHandler),
         (r"/file", FileHandler),
         (r"/", MainHandler),
     ]
     settings = {
         "cookie_secret": util.sha1("niot").hexdigest(),
         "static_path": TEMPLATE_PATH,
         # 'static_url_prefix':'resource/',
         "debug": False,
         "autoreload": True,
         "autoescape": "xhtml_escape",
         "i18n_path": os.path.join(CURRENT_PATH, "resource/i18n"),
         # 'login_url':'',
         "xheaders": True,  # use headers like X-Real-IP to get the user's IP address instead of
         # attributeing all traffic to the balancer's IP address.
     }
     super(Application, self).__init__(handlers, **settings)