Sometimes we need to create a secret key, but we don’t want to go to a website and generate it.
While I’m sure those websites are generally good guys – it only takes one bad guy stealing secret keys and you could end up in trouble.
To get a secret key form the terminal – run this code:
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
Thanks to Humberto for the source!