Committing Machine Specific Configuration Files

后端 未结 10 1542
我在风中等你
我在风中等你 2020-11-22 06:43

A common scenario when I develop is that the codebase will have several config files which require machine specific settings. These files will be checked into Git and other

10条回答
  •  梦谈多话
    2020-11-22 07:24

    Nowadays (2019) I use ENV vars for example in python/django, you can also add defaults to them. In the context of docker I can save the ENV vars in a docker-compose.yml file or an extra file which is ignored in version control.

    # settings.py
    import os
    DEBUG = os.getenv('DJANGO_DEBUG') == 'True'
    EMAIL_HOST = os.environ.get('DJANGO_EMAIL_HOST', 'localhost')
    

提交回复
热议问题