Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change secret storage recommandation #59

Open
MercierCorentin opened this issue Sep 4, 2023 · 0 comments
Open

Change secret storage recommandation #59

MercierCorentin opened this issue Sep 4, 2023 · 0 comments

Comments

@MercierCorentin
Copy link

MercierCorentin commented Sep 4, 2023

I would recommend putting the secret key inside an .env file that would store all secrets (including admin and database password) and from settings.pygetting the secret key like this. Then we can gitignore the .envfile.

settings.py

import os

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get(
    "DJANGO_SECRET_KEY"
)

.env

DATABASE_NAME=**********
DATABASE_USER=**********
DATABASE_PASSWORD=**********
...

DJANGO_SECRET_KEY={SECRET_KEY}

...

I think this method helps preventing mistakes while facilitating collaboration as there are many things we can change inside settings.pythat we would want other developpers to pull.

The current recommendation:

So recommended: Keep it safe. Ignore
settings.py file in your commits. Change the secret
key on your deploy. If you lost the secret key for any reason or
the server got compromised change it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant