1import secrets
2import string
3
4def generate_django_secret_key(length=50):
5 characters = string.ascii_letters + string.digits
6 secret_key = ''.join(secrets.choice(characters) for _ in range(length))
7 return secret_key
8
9django_secret_key = generate_django_secret_key()
10print(django_secret_key)