22
Dec
Django SECRET_KEY need for providing cryptographic signing (documentation). This value is stored in <your_app>/settings.py file. When you start new project it will be generated from built-in function (source code). For production deployment SECRET_KEY must be strong and reliably protected. These steps help you for generating new SECRET_KEY value: Activate your project's virtual environment: source env/bin/activate Enter fullscreen mode Exit fullscreen mode Enter in Django's manage.py shell: python3 manage.py shell Enter fullscreen mode Exit fullscreen mode Import get_random_secret_key() function: from django.core.management.utils import get_random_secret_key Enter fullscreen mode Exit fullscreen mode Just call get_random_secret_key() function: get_random_secret_key() Enter fullscreen mode Exit fullscreen mode Full…