通过环境变量配置应用程序的工具
py-env-config的Python项目详细描述
环境配置
通过环境变量配置应用程序的工具
- 自由软件:麻省理工学院许可证
- 文档:https://env-config.readthedocs.io。
功能
从以 app_name允许您选择加载环境变量 作为json
Example with load_as_json=True
fromenv_configimportget_envvar_configuration# Assuming that there are the following environment variables# MYAPP_BOOL=false# MYAPP_DICT={"some_key": "some_value"}# MYAPP_STRING=blahblahblah# NOTMYAPP_VARIABLE=this wont be recognizedconfig=get_envvar_configuration('myapp')print(config)# prints out {'BOOL': False, 'DICT': {'some_key': 'some_value'}, 'STRING': 'blahblahblah'}Example with load_as_json=False
config=get_envvar_configuration('myapp',load_as_json=False)print(config)# prints out {'BOOL': 'false', 'DICT': '{"some_key": "some_value"}', 'STRING': 'blahblahblah'}
学分
这个包是用Cookiecutter和audreyr/cookiecutter-pypackage项目模板创建的。
历史记录
0.1.0(2016-07-11)
- pypi上的第一个版本。