-
Next config var is
SECRET_KEY
. We will generate this using Django shell.- In terminal session in root of repository, create a key and be prepared to copy it to Heroku application settings "Config Vars":
-
Start Django shell:
python manage.py shell
-
Import
get_random_secret_key
:
from django.core.management.utils import get_random_secret_key
-
Use
get_random_secret_key
to get a new key:
print(get_random_secret_key())
-
Sample output:
PS C:\Users\FlynntKnapp\Programming\my-local-repository> python .\manage.py shell Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from django.core.management.utils import get_random_secret_key >>> print(get_random_secret_key()) sm)_qnnxl1*a4r$vtwe%cc%+=t4uyxlqh9d%3_u$=e@oc-)61( >>> quit()
-
Add
SECRET_KEY
as theKEY
and the output string in previous step as theVALUE
: -
Proceed to Add Database Settings to Config Vars