Python configuration file: Any file format recommendation? INI format still appropriate? Seems quite old school

前端 未结 8 1735
执念已碎
执念已碎 2020-12-04 10:43

I need to store configurations (key/value) for a Python application and I am searching for the best way to store these configurations in a file.

I run into Python\'s

8条回答
  •  醉酒成梦
    2020-12-04 11:08

    I ran into same problem more than once. I love the idea of python file(s) as settings files, it's just simple, elegant and all fellow python devs like it. Same time not really convinced with execfile idea.

    So I went ahead and created Converge.

    It supports some advanced options but at it's heart it simple python module as settings file.

    It's as simple as

    • creating default_settings.py, prod_settings.py
    • pip install converge
    • import settings

提交回复
热议问题