consts.py 文件源码

python
阅读 46 收藏 0 点赞 0 评论 0

项目:foremast 作者: gogoair 项目源码 文件源码
def load_dynamic_config(configurations, config_dir=getcwd()):
    """Load and parse dynamic config"""
    # Create full path of config
    config_file = '{path}/config.py'.format(path=config_dir)

    # Insert config path so we can import it
    sys.path.insert(0, path.dirname(path.abspath(config_file)))
    try:
        config_module = __import__('config')

        for key, value in config_module.CONFIG.items():
            LOG.debug('Importing %s with key %s', key, value)
            # Update configparser object
            configurations.update({key: value})
    except ImportError:
        # Provide a default if config not found
        configurations = {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号