def generate_django_secretkey():
 chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
 return get_random_string(50, chars)

def generate_django_secretkey ( ) : chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' return get_random_string ( 50 , chars )
secret key generation taken from djangos startproject .