Skip to content

Instantly share code, notes, and snippets.

@foresmac
Forked from mattseymour/django-secret-keygen.py
Last active October 6, 2015 20:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foresmac/ad987b09b864319fba86 to your computer and use it in GitHub Desktop.
Save foresmac/ad987b09b864319fba86 to your computer and use it in GitHub Desktop.
"""
Pseudo-random django secret key generator.
- Does print SECRET key to terminal which can be seen as unsafe.
"""
import string
import random
# Just use letters and digits to simplfy setting values from user_data.txt
chars = ''.join([string.ascii_letters, string.digits])
SECRET_KEY = ''.join([random.SystemRandom().choice(chars) for i in range(50)])
print SECRET_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment