Django SECRET_KEY Generator
50 characters from Django’s own alphabet, identical to get_random_secret_key().
Very strong0 bitsGenerated in your browser
Local alternative
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Prefer generating secrets on the machine that uses them? This command produces an equivalent value.
Official documentationDjango uses the SECRET_KEY for session signatures, CSRF tokens and password reset links. It draws from a fixed 50-character alphabet: lowercase letters, digits and a set of symbols, but no uppercase letters. Rotating it invalidates all sessions and any outstanding reset links.
Frequently asked questions
Into the SECRET_KEY setting, which should read the value from an environment variable. The one django-admin startproject writes into settings.py is meant for development and does not belong in production.
The generator uses the same 50-character alphabet as Django's own get_random_secret_key(). That keeps the value compatible with everything Django derives from it.
Sessions, password reset links, messages-framework signatures and every other value produced through signing lose their validity. Users are signed out and open reset links stop working.