Skip to content

Instantly share code, notes, and snippets.

@arocks
Created February 4, 2019 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arocks/381efb0faf1e2a9a1ccc003277dfb4bb to your computer and use it in GitHub Desktop.
Save arocks/381efb0faf1e2a9a1ccc003277dfb4bb to your computer and use it in GitHub Desktop.
Create a new environment variable called SECRET_KEY with a new random value
heroku config:set SECRET_KEY=(python -c 'import random; import string; print("".join([random.SystemRandom().choice("{}{}{}".format(string.ascii_letters, string.digits, string.punctuation)) for i in range(50)]))')
@arocks
Copy link
Author

arocks commented Nov 5, 2019

On Windows, do this in two steps:

C:\project> python -c "import random; import string; print(''.join([random.SystemRandom().choice('{}{}{}'.format(string.ascii_letters, string.digits, string.punctuation)) for i in range(50)]))"

and then

C:\project> heroku config:set <the result from last command>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment