コード例 #1
0
ファイル: main.py プロジェクト: bec4602/ppmessage
    def __init__(self):
        settings = {}
        settings["debug"] = True
        settings["cookie_secret"] = "24oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo="
        settings["template_path"]= os.path.join(os.path.dirname(__file__), "../resource/template")

        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)

        DownloadHandler.set_cls_redis(self.redis)
        
        self.geoip_reader = load_ip2geo()
        if self.geoip_reader == None:
            sys.exit()
            
        self.total_handlers = get_total_handlers()
        self.total_delegates = get_total_delegates(self)
        
        handlers = [(r"/", EntryHandler)]
        for i in self.total_handlers:
            handler = ("/" + i["name"].lower() + i["handler"][0], i["handler"][1])
            if len(i["handler"]) == 3:
                handler = ("/" + i["name"].lower() + i["handler"][0], i["handler"][1], i["handler"][2])
            handlers.append(handler)

        tornado.web.Application.__init__(self, handlers, **settings)        
        return
コード例 #2
0
ファイル: main.py プロジェクト: rudyzhuang/ppmessage
    def __init__(self):
        settings = {}
        settings["debug"] = True
        settings[
            "cookie_secret"] = "24oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo="
        settings["template_path"] = os.path.join(os.path.dirname(__file__),
                                                 "../resource/template")

        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)

        DownloadHandler.set_cls_redis(self.redis)

        self.total_handlers = get_total_handlers()
        self.total_delegates = get_total_delegates(self)

        handlers = [(r"/", EntryHandler)]
        for i in self.total_handlers:
            _name = "/" + i["name"].lower() + i["handler"][0]

            handler = (_name, i["handler"][1])
            if len(i["handler"]) == 3:
                handler = (_name, i["handler"][1], i["handler"][2])
            handlers.append(handler)

        tornado.web.Application.__init__(self, handlers, **settings)
        return
コード例 #3
0
ファイル: main.py プロジェクト: zhanglanrui/ppmessage
    def __init__(self):
        settings = {}
        settings["debug"] = True
        settings[
            "cookie_secret"] = "24oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo="
        settings["template_path"] = os.path.join(os.path.dirname(__file__),
                                                 "../resource/template")

        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)

        self.geoip_reader = load_ip2geo()
        if self.geoip_reader == None:
            sys.exit()

        self.total_handlers = get_total_handlers()
        self.total_delegates = get_total_delegates(self)

        handlers = []
        for i in self.total_handlers:
            handler = ("/" + i["name"].lower() + i["handler"][0],
                       i["handler"][1])
            if len(i["handler"]) == 3:
                handler = ("/" + i["name"].lower() + i["handler"][0],
                           i["handler"][1], i["handler"][2])
            handlers.append(handler)

        tornado.web.Application.__init__(self, handlers, **settings)
        return