Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.58 KB

06_add_secret_key_to_config_vars.md

File metadata and controls

41 lines (29 loc) · 1.58 KB

06 - Add Django SECRET_KEY to Config Vars

Resources

Process

  1. 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":
    1. Start Django shell:
      python manage.py shell

    2. Import get_random_secret_key:
      from django.core.management.utils import get_random_secret_key

    3. 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()
  2. Add SECRET_KEY as the KEY and the output string in previous step as the VALUE: 06_secret_key_entered

  3. Click the "Add" button. 07_click_add_button

  4. Proceed to Add Database Settings to Config Vars

Repository Links

README.md