Example #1
0
def start(config_file, *args):
    # load config
    import yaml
    runtime_config = yaml.load(open(config_file)) or {}

    # update config
    for k, v in runtime_config.items():
        setattr(config, k, v)
        
    # import plugins
    plugins = []
    for p in config.get('plugins') or []:
        plugins.append(__import__(p, None, None, ["x"]))
        print >> web.debug, "loaded plugin", p
        
    web.config.db_parameters = parse_db_parameters(config.db_parameters)    

    # initialize cache
    cache_params = config.get('cache', {'type': 'none'})
    cache.global_cache = cache.create_cache(**cache_params)
    
    # init plugins
    for p in plugins:
        m = getattr(p, 'init_plugin', None)
        m and m()
        
    # start running the server
    sys.argv = [sys.argv[0]] + list(args)
    run()
Example #2
0
def load_config(config_file):
    # load config
    import yaml
    runtime_config = yaml.load(open(config_file)) or {}

    # update config
    for k, v in runtime_config.items():
        setattr(config, k, v)
        
    # import plugins
    plugins = []
    for p in config.get('plugins') or []:
        plugins.append(__import__(p, None, None, ["x"]))
        logger.info("loading plugin %s", p)
        
    web.config.db_parameters = parse_db_parameters(config.db_parameters)    

    # initialize cache
    cache_params = config.get('cache', {'type': 'none'})
    cache.global_cache = cache.create_cache(**cache_params)
    
    # init plugins
    for p in plugins:
        m = getattr(p, 'init_plugin', None)
        m and m()
Example #3
0
def load_config(config_file):
    # load config
    import yaml
    runtime_config = yaml.load(open(config_file)) or {}

    # update config
    for k, v in runtime_config.items():
        setattr(config, k, v)

    # import plugins
    plugins = []
    for p in config.get('plugins') or []:
        plugins.append(__import__(p, None, None, ["x"]))
        logger.info("loading plugin %s", p)

    web.config.db_parameters = parse_db_parameters(config.db_parameters)

    # initialize cache
    cache_params = config.get('cache', {'type': 'none'})
    cache.global_cache = cache.create_cache(**cache_params)

    # init plugins
    for p in plugins:
        m = getattr(p, 'init_plugin', None)
        m and m()
Example #4
0
    def __init__(self, routes, config):
        super(CookieResolver, self).__init__(routes, config)
        self.magic_name = config['magic_name']
        self.sethost_prefix = '-sethost.' + self.magic_name + '.'
        self.set_prefix = '-set.' + self.magic_name

        self.cookie_name = config.get('cookie_name', self.SESH_COOKIE_NAME)
        self.proxy_select_view = config.get('proxy_select_view')

        self.extra_headers = config.get('extra_headers')

        self.cache = create_cache()
Example #5
0
    def __init__(self, routes, config):
        config['pre_connect'] = False
        super(CookieResolver, self).__init__(routes, config)
        self.magic_name = config['magic_name']
        self.sethost_prefix = '-sethost.' + self.magic_name + '.'
        self.set_prefix = '-set.' + self.magic_name

        self.cookie_name = config.get('cookie_name', self.SESH_COOKIE_NAME)
        self.proxy_select_view = config.get('proxy_select_view')

        self.extra_headers = config.get('extra_headers')

        self.cache = create_cache()
Example #6
0
 def __init__(self, routes, config):
     super(IPCacheResolver, self).__init__(routes, config)
     self.cache = create_cache()
     self.magic_name = config['magic_name']
Example #7
0
 def __init__(self, routes, config):
     super(IPCacheResolver, self).__init__(routes, config)
     self.cache = create_cache(config.get('redis_cache_key'))
     self.magic_name = config['magic_name']