Esempio n. 1
0
 def __init__(self, flag, port):
     handlers = [(r"/", IndexHandler),
                 (r"/shop", ShopHandler, {
                     "flag": flag
                 }), (r"/task", TaskHandler), (r"/login", LoginHandler)]
     Application.__init__(self, handlers, **aplication_config)
     print('Inited on http://localhost:{}'.format(port))
Esempio n. 2
0
    def __init__(self, extra_handlers):
        '''Expects a list of tuple handlers like:
                [(r"/", MainHandler), (r"/chatsocket", ChatSocketHandler),]
        '''
        url = settings._server_str % (settings.PROTOCOL, settings.HOSTNAME,
                                      settings.AUTHSERVERPORT)

        app_settings = {
            "cookie_secret": settings.COOKIE_SECRET,
            "login_url": ''.join((url, "/login")),
        }

        handlers = []
        handlers.append((r"/version", VersionHandler))
        handlers.append((r"/source", SelfServe))
        handlers.append((r"/ping", PingHandler))
        handlers.append((r"/", PingHandler))

        handlers.extend(extra_handlers)

        options.parse_command_line()
        dburi = options.dburi

        # Connect to the elixir db
        setup(db_uri=dburi)

        Application.__init__(self, handlers, debug=True, **app_settings)
Esempio n. 3
0
 def __init__(self, _web):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     settings = {}
     settings["debug"] = True
     handlers = []
     handlers.extend(_web)
     Application.__init__(self, handlers, **settings)
Esempio n. 4
0
 def __init__(self):
     settings = {}
     settings["debug"] = True
     handlers = []
     handlers.extend(UploadWebService.get_handlers())
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     Application.__init__(self, handlers, **settings)
Esempio n. 5
0
	def __init__(self):
		handlers=[
		(r'/Login',Login),
		(r'/Regist',Regist),
		(r'/Bullet',ConnectHandler)
		]
		Application.__init__(self,handlers)
Esempio n. 6
0
 def __init__(self):
     settings = {
       "static_path": os.path.join(os.path.dirname(__file__), "static"),
       "cookie_secret": COOKIE_KEY,
       "login_url": "/login",
     }
     Application.__init__(self, routes, debug=DEBUG, **settings)
Esempio n. 7
0
    def __init__(self, opts, profiles):
        """init server, add route to server"""       
        settings = dict(
            template_path           = os.path.join(os.path.dirname(__file__), "core/tpl"),
            static_path             = os.path.join(os.path.dirname(__file__), "core/static"),            
            cookie_name             = opts.server_name,
            cookie_secret           = opts.cookie_secret,
            xsrf_cookie             = True,
            session_secret          = opts.session_secret,
            session_timeout         = int(opts.session_timeout),
            memcached_address       = ["127.0.0.1:11211"],
            login_url               = "/accounts/login",
            ui_modules              = uimodules,
            debug                   = bool(opts.debug),
            weibo_key               = opts.weibo_key,
            weibo_secret            = opts.weibo_secret,
            tencent_key             = opts.tencent_key,
            tencent_secret          = opts.tencent_secret,
            douban_key              = opts.douban_key,
            douban_secret           = opts.douban_secret,
            opts                    = opts,
            profiles                = profiles
        )
        
        Application.__init__(self, handlers, **settings)

        self.session_manager = session.SessionManager(settings["session_secret"], 
                                                      settings["memcached_address"], 
                                                      settings["session_timeout"])
        self.mc = pylibmc.Client(["127.0.0.1"])
Esempio n. 8
0
    def __init__(self):
        handlers = [
            (r"/login", auth_handlers.LoginHandler),
        ]
        ui_modules = {
        }
        settings = dict(
            #debug
            debug = True,

            #set modules
            ui_modules = ui_modules,

            #tornado template lookup
            template_path  = os.path.join(PROJECT_DIR, "templates"),

            #tornado httpserver static path
            static_path = os.path.join(PROJECT_DIR, "static"),

            #tmp file path
            tmp_path = os.path.join(PROJECT_DIR, "tmp"),

            #tornado auth login url
            login_url = "/login",

            #cookie settings
            xsrf_cookies = False,
            cookie_secret = 'thy_secret',

        )
        Application.__init__(self, handlers, **settings)
Esempio n. 9
0
 def __init__(self):
     handlers = [
         (r"/api/v1/sync/?", AllSyncHandler),
         (r"/api/v1/sync/repo/?", RepoSyncHandler),
         (r"/api/v1/sync/cve/?", CveSyncHandler),
     ]
     Application.__init__(self, handlers)
Esempio n. 10
0
    def __init__(self):
        handlers = [
            (r"/login", auth_handlers.LoginHandler),
        ]
        ui_modules = {}
        settings = dict(
            #debug
            debug=True,

            #set modules
            ui_modules=ui_modules,

            #tornado template lookup
            template_path=os.path.join(PROJECT_DIR, "templates"),

            #tornado httpserver static path
            static_path=os.path.join(PROJECT_DIR, "static"),

            #tmp file path
            tmp_path=os.path.join(PROJECT_DIR, "tmp"),

            #tornado auth login url
            login_url="/login",

            #cookie settings
            xsrf_cookies=False,
            cookie_secret='thy_secret',
        )
        Application.__init__(self, handlers, **settings)
Esempio n. 11
0
    def __init__(self):
        # handlers = [
        #      (r'/', IndexHandler),
        #
        #     # 所有html静态文件都默认被StaticFileHandler处理
        #      # (r'/tpl/(.*)', StaticFileHandler, {
        #      #     'path': os.path.join(os.path.dirname(__file__), 'templates')
        #      # }),
        #      # PC端网页
        #      # (r'/f/', RedirectHandler, {'url': '/f/index.html'}),
        #      # (r'/f/(.*)', StaticFileHandler, {
        #      #     'path': os.path.join(os.path.dirname(__file__), 'front')
        #      # }),
        #  ]
        handlers = []
        handlers.extend(nui.routes)
        handlers.extend(service.routes)
        handlers.extend(stock.routes)
        handlers.extend(smscenter.routes)
        handlers.extend(weui.routes)
        handlers.extend(routes)
        site_url_prefix = settings.get(constant.SITE_URL_PREFIX, "")
        if site_url_prefix:
            # 构建新的URL
            handlers = map(
                lambda x: url(site_url_prefix + x.regex.pattern, x.handler_class, x.kwargs, x.name), handlers
            )

        # handlers = get_handlers()

        # 配置默认的错误处理类
        settings.update({"default_handler_class": ErrorHandler, "default_handler_args": dict(status_code=404)})

        Application.__init__(self, handlers=handlers, **settings)
Esempio n. 12
0
    def __init__(self):
       
        settings = {}
        settings["debug"] = True
        settings["cookie_secret"] = "PzEMu2OLSsKGTH2cnyizyK+ydP38CkX3rhbmGPqrfBs="

        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
        DownloadHandler.set_cls_redis(self.redis)
        _root = os.path.abspath(os.path.dirname(__file__)) + "/ppkefu/www"

        _generic_store = BOOTSTRAP_DATA.get("server")
        _generic_store = _generic_store.get("generic_store")
        
        handlers = [
            (r"^/$", MainHandler),
            (r"^/cordova.js$", CordovaHandler),
            (r"/js/(.*)", StaticFileHandler, {"path": _root + "/js"}),
            (r"/build/(.*)", StaticFileHandler, {"path": _root + "/build"}),
            (r"/css/(.*)", StaticFileHandler, {"path": _root + "/css"}),
            (r"/templates/(.*)", StaticFileHandler, {"path": _root + "/templates"}),
            (r"/lib/(.*)", StaticFileHandler, {"path": _root + "/lib"}),
            (r"/img/(.*)", StaticFileHandler, {"path": _root + "/img"}),
            
            (r"/download/(.*)", DownloadHandler, {"path": "/"}),
            (r"/icon/([^\/]+)?$", StaticFileHandler, {"path": _generic_store + os.path.sep}),
            (r"/material/([^\/]+)?$", MaterialFileHandler, {"path": _generic_store + os.path.sep}),
            (r"/upload/(.*)", UploadHandler),
        ]

        Application.__init__(self, handlers, **settings)
Esempio n. 13
0
    def __init__(self):
        handlers = [
            (r'/api/v1/hello', WebSocketCrawlHandler)
        ]

        settings = {'debug': True}
        Application.__init__(self, handlers, **settings)
Esempio n. 14
0
    def __init__(self):
        handlers = [
            (r"/", IndexHandler),
            (r"/schedule", ScheduleHandler),
            (r"/recently", RecentlyViewHandler),
            (r"/overview", OverViewHandler),
            (r"/domains", DomainsViewHandler),
            (r"/details", DomainDetailHandler),
        ]
        config = dict(
            template_path=os.path.join(os.path.dirname(__file__), settings.TEMPLATE_ROOT),
            static_path=os.path.join(os.path.dirname(__file__), settings.STATIC_ROOT),
            #xsrf_cookies=True,
            cookie_secret="__TODO:_E720135A1F2957AFD8EC0E7B51275EA7__",
            autoescape=None,
            debug=settings.DEBUG
        )
        Application.__init__(self, handlers, **config)

        self.rd_main = redis.Redis(settings.REDIS_HOST,
                                   settings.REDIS_PORT,
                                   db=settings.REDIS_DB)
        self.db = Connection(
            host=settings.MYSQL_HOST, database=settings.MYSQL_DB,
            user=settings.MYSQL_USER, password=settings.MYSQL_PASS)
Esempio n. 15
0
    def __init__(self, config_file):
        self.config_file = config_file
        load(config_file)

        content_store_service = ContentStoreService()
        handlers = [(
            '/tagger/document',
            DocumentHandler,
            {
                "content_store_service": content_store_service,
                "document_processor": DocumentProcessor(content_store_service)
            },
        ),
                    (
                        '/tagger/documents',
                        DocumentsHandler,
                        {
                            "content_store_service": content_store_service,
                            "processor":
                            DocumentProcessor(content_store_service)
                        },
                    ), ('/summary/document/_summarize', SummaryHandler),
                    ('/summary/document/check_summarizability',
                     SummaryHandler),
                    ('/trinity/diagnostics/humans.txt', VersionHandler),
                    ('/trinity/diagnostics/config.txt', ConfigHandler),
                    ('/trinity/diagnostics/status.txt', StatusHandler),
                    ('/similarity/documents', SimilarityHandler, {
                        "similarity_service": SimilarityService(0.6)
                    }),
                    ('/similarity/resources', ResourceSimilarityHandler, {
                        "similarity_threshold": 0.25
                    })]
        Application.__init__(self, handlers)
Esempio n. 16
0
    def __init__(self, *args, **kwargs):
        super(RobotApp, self).__init__(*args, **kwargs)

        # every app_uuid get its svm, vector, target (label->string).
        self.svm = {}
        self.vector = {}
        # target string array
        self.target = {}

        _key = AppInfo.__tablename__ + ".uuid." + self._app_uuid
        _robot_uuid = self.redis.hget(_key, "robot_user_uuid")
        if _robot_uuid == None:
            logging.error("no robot user uuid")
            sys.exit()
            
        self.robot_user_uuid = _robot_uuid

        self.robot_key = REDIS_ROBOT_KEY
        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
        self.predict_answer_handler = PredictAnswerHandler(self)
        self.predict_user_handler = PredictUserHandler(self)
        self.fit_handler = FitHandler(self)
        
        settings = {}
        settings["debug"] = True
        handlers = []
        Application.__init__(self, handlers, **settings)

        return
Esempio n. 17
0
    def __init__(self):
        handlers = [
           (r'/',IndexHandler),

           # 所有html静态文件都默认被StaticFileHandler处理
           (r'/tpl/(.*)',StaticFileHandler,{
               'path':os.path.join(os.path.dirname(__file__),'templates')
           }),
           # PC端网页
           (r'/f/',RedirectHandler,{'url':'/f/index.html'}),
           (r'/f/(.*)',StaticFileHandler,{
               'path':os.path.join(os.path.dirname(__file__),'front')
           }),
           # 手机端网页
           (r'/m/',RedirectHandler,{'url':'/m/index.html'}),
           (r'/m/(.*)',StaticFileHandler,{
               'path':os.path.join(os.path.dirname(__file__),'mobile')
           }),
        ]
        handlers.extend(auth.route)
        handlers.extend(message.route)
        handlers.extend(rbac.route)
        handlers.extend(ds.route)
        handlers.extend(weui.routes)
        handlers.extend(mobile.route)
        Application.__init__(self, handlers=handlers, **settings)
Esempio n. 18
0
    def __init__(self, settings):
        config = dict(
            template_path=os.path.join(os.path.dirname(__file__),
                                       settings.TEMPLATE_ROOT),
            static_path=os.path.join(os.path.dirname(__file__),
                                     settings.STATIC_ROOT),
            cookie_secret="__E720175A1F2957AFD8EC0E7B51275EA7__",
            login_url='/login',
            autoescape=None,
            debug=settings.DEBUG
        )
        Application.__init__(self, handlers, **config)

        conn = S3Connection()
        self.bucket = conn.get_bucket(settings.APK_BUCKET)
        self.redis = redis.Redis(
            host=settings.REDIS_HOST,
            port=settings.REDIS_PORT,
            db=settings.REDIS_DB,
            password=settings.REDIS_PASS
        )

        self.db = MotorReplicaSetClient(
            settings.MONGO_CONNECTION_STRING,
            replicaSet='android'
        )[settings.MONGO_DB]

        self.engine = Base(settings)
        self.api = self.engine.login(async=True)
Esempio n. 19
0
 def __init__(self):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     settings = {}
     settings["debug"] = True
     Application.__init__(self, PCSocketWebService.get_handlers(),
                          **settings)
     return
Esempio n. 20
0
    def __init__(self):
        handlers = [
            (r'/', IndexHandler),

            # 所有html静态文件都默认被StaticFileHandler处理
            (r'/tpl/(.*)', StaticFileHandler, {
                'path': os.path.join(os.path.dirname(__file__), 'templates')
            }),
            # PC端网页
            (r'/f/', RedirectHandler, {
                'url': '/f/index.html'
            }),
            (r'/f/(.*)', StaticFileHandler, {
                'path': os.path.join(os.path.dirname(__file__), 'front')
            }),
            # 手机端网页
            (r'/m/', RedirectHandler, {
                'url': '/m/index.html'
            }),
            (r'/m/(.*)', StaticFileHandler, {
                'path': os.path.join(os.path.dirname(__file__), 'mobile')
            }),
        ]
        handlers.extend(auth.route)
        handlers.extend(message.route)
        handlers.extend(rbac.route)
        handlers.extend(ds.route)
        handlers.extend(weui.routes)
        handlers.extend(mobile.route)
        Application.__init__(self, handlers=handlers, **settings)
Esempio n. 21
0
    def __init__(self):
        settings = load_settings(config)
        handlers = [
            (r'/$', StaticHandler, dict(
                template_name='index.html',
                title=settings['site_title']
            )),
            (r'/drag', StaticHandler, dict(
                template_name='draggable.html',
                title=settings['site_title']
            )),
            (r'/http', StaticHandler, dict(
                template_name='httpdemo.html',
                title=settings['site_title']
            )),
            (r'/demo', HTTPDemoHandler),
            (r'/demo/quickstart',StaticHandler,dict(
                template_name='App/demo/quickstart.html'
            )),
            (r'/user/list', UserHandler),
            (r'/user', UserHandler),#post
            (r'/user/(\w+)', UserHandler),#delete
        ]

        self.db = settings['db']
        self.dbsync = settings['dbsync']

        Application.__init__(self, handlers, **settings)
Esempio n. 22
0
    def __init__(self):
        logging.getLogger().setLevel(options.logging_level)

        if options.debug:
            logging.warn("==================================================================================")
            logging.warn("SERVER IS RUNNING IN DEBUG MODE! MAKE SURE THIS IS OFF WHEN RUNNING IN PRODUCTION!")
            logging.warn("==================================================================================")

        logging.info("Starting server...")

        # apollo distribution root
        dist_root = os.path.join(os.path.dirname(__file__), "..", "..")

        Application.__init__(
            self,
            [
                (r"/",                  FrontendHandler),
                (r"/session",           SessionHandler),
                (r"/action",            ActionHandler),
                (r"/events",            EventsHandler),
                (r"/dylib/(.*)\.js",    DylibHandler)
            ],
            dist_root   = dist_root,
            static_path = os.path.join(dist_root, "static"),
            debug       = options.debug
        )

        self.loader = Loader(os.path.join(dist_root, "template"))

        setupDBSession()

        self.dylib_dispatcher = DylibDispatcher(self)
        self.bus = Bus(self)
        self.plugins = PluginRegistry(self)
        self.cron = CronScheduler(self)
Esempio n. 23
0
 def __init__(self):
     handlers = [(r"/login", LoginHandler), (r"/logout", LogoutHandler),
                 (r"/dnsmon", DNSMonHandler), (r"/aqb", AQBHandler),
                 (r"/api/aqb", AQBApiHandler),
                 (r"/api/aqb.check", AQBChangeHandler),
                 (r"/api/aqb.monitor", AQBMonitorHandler),
                 (r"/api/aqb.url", AQBURLHandler),
                 (r"/api/checkdnsdefault", CheckDnsDefault),
                 (r"/api/getdnstypelist", GetDnsTypeList),
                 (r"/api/zone", ZoneHandler),
                 (r"/api/record", RecordHandler),
                 (r"/api/record.disable", DisableRecordHandler),
                 (r"/api/recordnum", RecordNumHandler),
                 (r"/api/getrid", GetRecordIdHandler),
                 (r"/api/recordnum", RecordNumHandler),
                 (r"/api/zonenum", ZoneNumHandler),
                 (r"/api/zonelist", CheckZoneList),
                 (r"/api/zonegroup", ZoneGroupHandler),
                 (r"/api/changelog", ChangeLogHandler),
                 (r"/api/refresh", RefreshHandler),
                 (r"/records", RecordsHandler), (r"/zones", ZonesHandler)]
     settings = dict(
         template_path='adminweb/templates',
         static_path='adminweb/static',
         cookie_secret="61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
         login_url="/login",
         debug=options.DEBUG)
     print "DEBUG Options is %s." % options.DEBUG
     Application.__init__(self, handlers, **settings)
Esempio n. 24
0
 def __init__(self):
     handlers = [
         # TODO should implementing func that add prefix like /api/v1/ to all subroutes in one place
         url(r'/api/v1/rooms/(?P<room_id>\d+)/', RoomHandler, name='room'),
         url(r'/api/v1/rooms/(?P<room_id>\d+)/customers/',
             RoomCustomersHandler,
             name='room_customers'),
         url(r'/api/v1/rooms/(?P<room_id>\d+)/booking/',
             RoomBookingHandler,
             name='room_booking'),
         url(r'/api/v1/rooms/', RoomsHandler, name='rooms'),
         url(r'/api/v1/booking/', BookingHandler, name='booking'),
         url(r'/api/v1/booking/(?P<booking_id>\d+)/',
             BookingOrderHandler,
             name='booking_order'),
         url(r'/api/v1/customers/(?P<customer_id>\d+)/',
             CustomerHandler,
             name='customer'),
         url(r'/api/v1/customers/(?P<customer_id>\d+)/booking/',
             CustomerBookingHandler,
             name='customer_booking'),
         url(r'/api/v1/customers/(?P<customer_id>\d+)/rooms/',
             CustomerRoomsHandler,
             name='customer_rooms'),
         url(r'/api/v1/customers/', CustomersHandler, name='customers'),
         url(r'/api/v1/statuses/', StatusesHandler, name='statuses'),
         url(r'/api/v1/types/', TypesHandler, name='types')
     ]
     settings = dict(debug=True, )
     Application.__init__(self, handlers, **settings)
Esempio n. 25
0
    def __init__(self):
       
        settings = {}
        settings["debug"] = True
        settings["cookie_secret"] = "PzEMu2OLSsKGTH2cnyizyK+ydP38CkX3rhbmGPqrfBs="

        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
        DownloadHandler.set_cls_redis(self.redis)
        _root = os.path.abspath(os.path.dirname(__file__)) + "/ppkefu/www"

        _generic_store = BOOTSTRAP_DATA.get("server")
        _generic_store = _generic_store.get("generic_store")
        
        handlers = [
            (r"^/$", MainHandler),
            (r"^/cordova.js$", CordovaHandler),
            (r"/js/(.*)", StaticFileHandler, {"path": _root + "/js"}),
            (r"/css/(.*)", StaticFileHandler, {"path": _root + "/css"}),
            (r"/fonts/(.*)", StaticFileHandler, {"path": _root + "/fonts"}),
            (r"/img/(.*)", StaticFileHandler, {"path": _root + "/img"}),
            
            (r"/download/(.*)", DownloadHandler, {"path": "/"}),
            (r"/icon/([^\/]+)?$", StaticFileHandler, {"path": _generic_store + os.path.sep}),
            (r"/material/([^\/]+)?$", MaterialFileHandler, {"path": _generic_store + os.path.sep}),
            (r"/upload/(.*)", UploadHandler),
        ]

        Application.__init__(self, handlers, **settings)
Esempio n. 26
0
 def __init__(self, _web):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     settings = {}
     settings["debug"] = True
     handlers = []
     handlers.extend(_web)            
     Application.__init__(self, handlers, **settings)
Esempio n. 27
0
    def __init__(self, extra_handlers):
        '''Expects a list of tuple handlers like:
                [(r"/", MainHandler), (r"/chatsocket", ChatSocketHandler),]
        '''
        url = settings._server_str % (settings.PROTOCOL, settings.HOSTNAME, settings.AUTHSERVERPORT)

        app_settings = {
                "cookie_secret": settings.COOKIE_SECRET,
                "login_url": ''.join((url, "/login")),
                }

        handlers = []
        handlers.append((r"/version", VersionHandler))
        handlers.append((r"/source", SelfServe))
        handlers.append((r"/ping", PingHandler))
        handlers.append((r"/", PingHandler))

        handlers.extend(extra_handlers)

        options.parse_command_line()
        dburi = options.dburi

        # Connect to the elixir db
        setup(db_uri=dburi)

        Application.__init__(self, handlers, debug=True, **app_settings)
Esempio n. 28
0
    def __init__(self):
        logger.debug('Initializing application')

        self.radius_realm = settings.RADIUS_REALM
        self.system_name = get_system_name(settings.SYSTEM_NAME_FILE)

        self.create_hotsoap_auth_interface()
        self.create_db_connection_pool()
        self.create_mailer()
        self.create_thread_pool()
        self.create_rabbit_publisher()
        self.create_input_checker()
        self.create_users_sessions()

        self.define_urls()

        handlers = [
            (r'^/$', IndexHandler),
            (r'^/phone$', PhoneHandler),
            (r'^/code$', CodeHandler),
            (r'^/mail$', MailHandler),
            (r'^/auth$', AuthHandler),
            (r'^/lang?.*$', LangHandler),
            (r'/(.*)$', StaticFileHandler, { 'path':settings.STATIC_PATH })
        ]
        settings_dict = {
            'static_path' : settings.STATIC_PATH,
            'template_path' : settings.TEMPLATE_PATH
        }
        Application.__init__(self, handlers, **settings_dict)
        logger.debug('Application initialized')
Esempio n. 29
0
 def __init__(self):
     settings = {}
     settings["debug"] = True
     handlers = []
     handlers.extend(UploadWebService.get_handlers())
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     Application.__init__(self, handlers, **settings)
Esempio n. 30
0
    def __init__(self):

        settings = dict(
            debug=options.debug,
            xsrf_cookies=False,
            db=StockApplication.db,
            test_db=StockApplication.test_db,
            cookie_secret=options.cookie_secret,
            login_url="/login",
            static_path=os.path.join(here, "static")
        )
        paths = {"path": "./static"}
        handlers = [
            (r"/?", HomeHandler),
            (r"/condition/(macd|kdj|price)/?", ConditionHandler),
            (r"/algo/(upload|remove|list)/?", AlgoHandler),
            (r"/stock-list/?", StockListHandler),
            (r"/login/?", AuthLoginHandler),
            (r"/logout/?", AuthLogoutHandler),
            (r"/kdj/(day|hour|week)/?", KDJHandler),
            (r"/macd/(day|hour|week)/?", MACDHandler),
            (r"/static/(.*)", tornado.web.StaticFileHandler, paths)

        ]

        Application.__init__(self, handlers, **settings)
Esempio n. 31
0
    def __init__(self):
        handlers = [
            (r"/?", NotificationHandler),
            (r"/api/v1/monitoring/health/?", HealthHandler),
        ]

        Application.__init__(self, handlers)
Esempio n. 32
0
    def __init__(self, handlers=None, default_host="", transforms=None, wsgi=False, **settings):
        if not handlers:
            handlers = [
                (r"/_/api/changes", ChangeRequestHandler),
                (r"/_/api/?(.*)", APIRequestHandler),
                (r"/_/?(.*)", AssetsHandler, {"path": os.path.join(module_path(), '_')}),
                (r"/", RedirectHandler, {'url': '/_/index.html'}),
            ]
        if not settings:
            settings = {
                'debug': True,
                'template_path': os.path.join(module_path(), '_'),
            }
        if not default_host:
            default_host = '.*$'

        Application.__init__(self, handlers, default_host, transforms, wsgi, **settings)
        self.internal_handler_count = len(handlers)

        self.change_request_handlers = set()
        self.observer = ChangesObserver(changes_handler=self.change_happened)

        self.config_path = config_path()
        self.config = self.load_config()
        self.project = None
        for project in self.config.get('projects', []):
            if project.get('isCurrent'):
                self.project = project
                self.set_project(project)
                break
Esempio n. 33
0
    def __init__(self):

        handlers = (
            (r"/", IndexHandler),    
        )

        # application set 
        Application.__init__(self, handlers, **SETTINGS)
Esempio n. 34
0
    def __init__(self, routes, **settings):
        """
        Initialize tornado main Application.

        Args:
            routes : A list of touples contains route string and handler
        """
        TornadoApp.__init__(self, routes, **settings)
Esempio n. 35
0
 def __init__(self):
     settings = dict(auth_redirect_uri=None)
     handlers = [(r"/auth/google", start.GoogleOAuth2LoginHandler),
                 (r"/auth/callback",
                  start.GoogleOAuth2LoginHandler),
                 (r"/auth", start.LoginHandler)]
     Application.__init__(self, handlers, **settings)
     self.db = queries.TornadoSession(queries.uri(**dsn))
Esempio n. 36
0
 def __init__(self):
     handlers = [(r"/get_attendance_data/", SocketOutputHandler),
                 (r"/save_attendance_data/", EmployeeInputHandler),
                 (r"/dashboard/", DashboardHandler),
                 (r"/static/(.*)", StaticFileHandler, {
                     'path': os.path.join(os.curdir, "template", "assets")
                 })]
     Application.__init__(self, handlers)
Esempio n. 37
0
 def __init__(self):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     settings = {}
     settings["debug"] = True
     handlers = []
     handlers.append(("/", MainHandler))
     Application.__init__(self, handlers, **settings)
     return
Esempio n. 38
0
 def __init__(self, config):
     tornado_settings = config.TORNADO_SETTINGS
     print(tornado_settings)
     print(ROUTES)
     Application.__init__(self,
                          handlers=ROUTES,
                          session_factory=session_factory,
                          **tornado_settings)
Esempio n. 39
0
 def __init__(self):
    
     settings = {}
     settings["debug"] = True
     settings["cookie_secret"] = "PzEMu2OLSsKGTH2cnyizyK+ydP38CkX3rhbmGPqrfBs="
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     DownloadHandler.set_cls_redis(self.redis)
     Application.__init__(self, PPKefuWebService.get_handlers(), **settings)
Esempio n. 40
0
 def __init__(self):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     settings = {}
     settings["debug"] = True
     handlers = []
     handlers.append(("/", MainHandler))
     Application.__init__(self, handlers, **settings)
     return
Esempio n. 41
0
File: app.py Progetto: mshzhb/caller
    def __init__(self):
        urls = {('/start', 'handler.start.StartHandler'),
                ('/stop', 'handler.stop.StopHandler'),
                ('/status', 'handler.status_callback.StatusCallbackHandler')}

        settings = dict(autoescape=None, xsrf_cookies=False, debug=True)

        Application.__init__(self, urls, **settings)
Esempio n. 42
0
 def __init__(self):
     handlers = urlpatterns
     # 这里可填写连接数据库代码,并生成游标
     port_num = options['port']
     print('服务器程序启动成功')
     print(f'请打开浏览器输入 http://127.0.0.1:{port_num}')
     print('按下 Ctrl + C 退出服务器程序')
     Application.__init__(self, handlers,**settings)  # , debug=True)
Esempio n. 43
0
 def __init__(self):  # pylint: disable=super-init-not-called
     handlers = None
     Application.__init__(self, handlers)  # pylint: disable=non-parent-init-called
     self.instance = None
     self.vmaas_websocket_url = "ws://%s/" % os.getenv("VMAAS_WEBSOCKET_HOST", "vmaas_websocket:8082")
     self.vmaas_websocket = None
     self.reconnect_callback = None
     self.evaluator_queue = None
Esempio n. 44
0
 def __init__(self,
              handlers=None,
              default_host="",
              transforms=None,
              wsgi=False,
              **settings):
     Application.__init__(self, handlers, default_host, transforms, wsgi,
                          **settings)
     self.handler_map = OrderedDict()
Esempio n. 45
0
    def __init__(self):
        handlers = [(r"/?", NotificationHandler),
                    (r"/api/v1/monitoring/health/?", HealthHandler),
                    (r"/healthz/?", HealthHandler)]

        Application.__init__(self,
                             handlers,
                             websocket_ping_interval=WEBSOCKET_PING_INTERVAL,
                             websocket_ping_timeout=WEBSOCKET_TIMEOUT)
Esempio n. 46
0
File: run.py Progetto: ly-rs90/power
 def __init__(self):
     handlers = [
         (r'/(.*)', StaticFileHandler, {'path': app_root, 'default_filename': 'index.html'})
     ]
     settings = dict(
         cookie_secret='MY5qf2/oSCeLqtlelHFEEVTeII1mZE/KobHmruHkcVw=',
         debug=True
     )
     Application.__init__(self, handlers, **settings)
Esempio n. 47
0
 def __init__(self):
     db_handler = DbHandler(db_config)
     handlers = generate_sitemap() + [
         ("/news", NewsHandler, {"db":db_handler}),
         ("/admin", AdminHandler, {"db":db_handler}),
         ("/login", LoginHandler, {"db":db_handler})
     ]        
     Application.__init__(self, handlers, default_handler_class=Handler404, **aplication_config)
     print('[+] Server started at http://{}:{}'.format(options.host, options.port))
Esempio n. 48
0
    def __init__(self):

        self._set_config()
        self.db = Connection( config.DB_HOST, config.DB_NAME,
                              config.DB_USER, config.DB_PSWD, settings.get('debug'))
        #重写参数
        ehandlers = [ x + (dict(database = self.db),) for x in handlers]

        Application.__init__(self,handlers = ehandlers,default_host='localhsot',transforms=None,**settings)
Esempio n. 49
0
	def __init__(self, handler_set_list=[]):

		handlers = []
		for handlers_set in handler_set_list:
			uri = r"/%s" % handlers_set[0]
			hd = handlers_set[1]
			handlers.append((uri, hd))

		Application.__init__(self, handlers)
Esempio n. 50
0
 def __init__(self):
     settings = {}
     settings["debug"] = True
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     self.geoip_reader = load_ip2geo()
     if self.geoip_reader == None:
         sys.exit()
         
     Application.__init__(self, ApiWebService.get_handlers(), **settings)
Esempio n. 51
0
 def __init__(self):
     settings = {}
     settings["debug"] = True
     handlers = []
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     DownloadHandler.set_cls_redis(self.redis)
     handlers.append(("/download/([^\/]+)?$", DownloadHandler, {"path": "/"}))
     handlers.append(("/identicon/([^\/]+)?$", IdenticonHandler, {"path": "/"}))
     Application.__init__(self, handlers, **settings)
Esempio n. 52
0
 def __init__(self):
   settings = dict(
     static_path=os.path.join(_dir, "static"),
     template_path=os.path.join(_dir, "tpl"),
     #cookie_secret=options.cookie_secret,
     debug=options.debug,
     gzip=True,
   )
   Application.__init__(self, router, **settings)
Esempio n. 53
0
	def __init__(self, rest_handlers, resource=None, handlers=None, default_host="", transforms=None, **settings):
		restservices = []
		self.resource = resource
		for r in rest_handlers:
			svs = self._generateRestServices(r)
			restservices += svs
		if handlers != None:
			restservices += handlers
		Application.__init__(self, restservices, default_host, transforms, **settings)
Esempio n. 54
0
    def __init__(self):
        settings = {}
        settings["debug"] = True
        handlers = []

        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
        DownloadHandler.set_cls_redis(self.redis)        
        Application.__init__(self, DownloadWebService.get_handlers(), **settings)

        return
Esempio n. 55
0
    def __init__(self, handlers=None, default_host='', transforms=None,
                 wsgi=False, settings=None, plush=None, **rest):

        settings = Configuration(settings or {})
        settings.update(rest)

        self.plush = plush

        Application.__init__(self, rest.pop('routes', None) or handlers,
                                   default_host, transforms, wsgi, **settings)
Esempio n. 56
0
    def __init__(self):

        handlers = [
            (r'/upload_html', UploadHtmlHandler),
            (r'/login', LoginHandler),
        ]

        settings = dict()

        Application.__init__(self, handlers, settings)
Esempio n. 57
0
 def __init__(self):
     settings = {
         "cookie_secret": base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes),
         "xsrf_cookies": False,
         "autoescape": None,
         "gzip": True,
         "static_path": "static",
         "debug": False,
     }
     Application.__init__(self, [(r"/login", LoginHandler), (r"/(.*)", IndexHandler)], **settings)
    def __init__(self):

        handlers=[
            (r"/sleep", SleepHandler),
            (r"/justnow", JustNowHandler),
        ]
        print 'Support url:'
        print '\n'.join([i[0] for i in handlers])

        Application.__init__(self, handlers)