About Generating a Secret Key

Need a new Django secret key? You can generate it with these lines of code in Django shell:

1
2
3
4
>>> from django.core.management.utils import (
    get_random_secret_key
)
>>> print(get_random_secret_key())

Tips and Tricks Dev Ops Development Django 4.2 Django 3.2 Django 2.2