Credit Alex Van Liew. Original post: https://stackoverflow.com/a/31884002
-
Create a non-versioned file. Add a new file to your project directory (i.e., secrets.py), reference that file from your setting files, and add the 'secrets' file to your .gitignore list.
-
Use environment variables. Pass environment variables to your process and then retrieve them with your settins file.
-
Use a second repository in combination with Method 1, above. Create a dedicated 'secrets' repository that you store all of your secrets in.
Rewriting your GitHub history to remove secret info: Credit Warren Henning, Patrick Thomson, and Github. Original post: http://fearofcode.github.io/blog/2013/01/15/how-to-scrub-sensitive-information-from-django-settings-dot-py-files/
- Create a 'secret' file to hold your info.
- Make a copy of your 'settings.py' file that is scrubbed of secret information
- Follow GitHub's steps for removing sensitive data (https://help.github.com/articles/remove-sensitive-data)
- Copy the scrubbed / clean settings.py file into your GitHub repo