and there is a thing in Python called __future__ so you don't need to do this:<p><a href="https://github.com/ariestiyansyah/django-secret-key/blob/master/django-secret-key#L10" rel="nofollow">https://github.com/ariestiyansyah/django-secret-key/blob/mas...</a><p>Read more: <a href="https://docs.python.org/2/library/__future__.html" rel="nofollow">https://docs.python.org/2/library/__future__.html</a>
Since Django 1.10 you can simply use get_random_secret_key in django.core.management.utils.<p>This will not work:<p>if python3:
print (SECRET_KEY)
else:
print SECRET_KEY<p>because it's a syntax error in Python 3. Instead, you can just write "print (SECRET_KEY)", this works in both versions and has the same effect.
Also, why not import string and use string.printable instead of hardcoding the characters? Or even:<p><pre><code> chars = string.ascii_lowercase + string.punctuation + string.digits</code></pre>