def from_yaml(self, config_file):
"""Yaml config getter function.
Reads a yaml flask config file and generates a config
dictionary out of it that flask and aniping can
both understand.
Args:
config_file (str): the path of the config file to load.
Can be relative or absolute.
"""
env = os.environ.get('FLASK_ENV', 'development')
self['ENVIRONMENT'] = env.lower()
with open(config_file) as f:
config = yaml.safe_load(f)
config = config.get(env.upper(), config)
for key in config.keys():
if key.isupper():
self[key] = config[key]
评论列表
文章目录