How can I save my secret keys and password securely in my version control system?

前端 未结 17 1790
生来不讨喜
生来不讨喜 2020-11-29 14:49

I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it\'s bad practice to kee

17条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 15:12

    I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github.

    No, just don't, even if it's your private repo and you never intend to share it, don't.

    You should create a local_settings.py put it on VCS ignore and in your settings.py do something like

    from local_settings import DATABASES, SECRET_KEY
    DATABASES = DATABASES
    
    SECRET_KEY = SECRET_KEY
    

    If your secrets settings are that versatile, I am eager to say you're doing something wrong

提交回复
热议问题