Skip to content

Instantly share code, notes, and snippets.

@belen-albeza
Created September 20, 2013 15:23
Show Gist options
  • Save belen-albeza/6639204 to your computer and use it in GitHub Desktop.
Save belen-albeza/6639204 to your computer and use it in GitHub Desktop.
Generates a random secret key à la Django. Based on https://gist.github.com/ndarville/3452907
import random
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
key = ''.join([random.SystemRandom().choice(chars) for i in range(50)])
print key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment