Exemplo n.º 1
0
def load_config(config_file, section):
    """
    load custom configure by section
    """
    config = Config(config_file=config_file)
    settings.CONFIG = config
    for re in config.get_config_list(section):
        setattr(settings, re[0].upper(), re[1])
Exemplo n.º 2
0
def _start(root_path):
    """
    link to start command
    :param root_path:
    :return:
    """
    try:
        path = os.path.join(root_path, settings.MAIN_CONFIG)
        if not os.path.exists(path):
            print("[WARN]:[{}] not found.".format(path))
            return
        config = Config(path)
        settings.CONFIG = config
        script = config.get_config('settings', 'default')
        if script:
            return script
        else:
            print("[WARN]:[{}] not found in [{}].".format(
                'default script module name', path))
            return
    except Exception as e:
        print(e)
Exemplo n.º 3
0
 def setUp(self):
     self.config = Config("./config.ini")