Search code examples
pythondjangopython-venv

Why does my django-project work when I change my secret_key?


I change my SECRET_KEY in django project, and i start it again using manage.py runserver, but project is still working. How is it possible,? I think the project should not work.

I try replace SECRET_KEY from .env back to settings.py. But it doesn`t help.


Solution

  • Your project would work whatever key you use. Your secret key is just a salt... Your project would only raise issues with secret keys when you try to deploy it with the default key. Django would then force you to change your secret key to something else and burn all copies. Just Kidding. Just keep them...well, secret and safe. While salts are just used to make hashes to secure your app... If an attacker got their hands on your secret key, could be bad...'run manage.py check --deploy' to understand these requirements better...