Last active
March 7, 2018 18:25
-
-
Save doctaphred/d8f076fff93b8760968a306278e0a22c to your computer and use it in GitHub Desktop.
Generate a secret key suitable for use with Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Generate a new secret key suitable for use with Django. | |
Uses the same process as django.core.management.utils:get_random_secret_key. | |
""" | |
from random import SystemRandom | |
random = SystemRandom() | |
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' | |
print(''.join(random.choice(chars) for _ in range(50))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment