Skip to content

Instantly share code, notes, and snippets.

@seancallaway
Created September 30, 2019 01:20
Show Gist options
  • Select an option

  • Save seancallaway/1c4a07ab2961b0696cf28d738dd61118 to your computer and use it in GitHub Desktop.

Select an option

Save seancallaway/1c4a07ab2961b0696cf28d738dd61118 to your computer and use it in GitHub Desktop.
Generate a SECRET_KEY for Django
import random
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)'
secure_random = random.SystemRandom()
print(''.join(secure_random.sample(charset, 50)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment