Distributing Django projects with unique SECRET_KEYs

To add to what Carles Barrobés said, you can generate a new key using the method that Django uses in startproject:

from django.utils.crypto import get_random_string

chars="abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
get_random_string(50, chars)

For Django 1.10 and above, the above code snippet is nicely wrapped up in a function.

from django.core.management.utils import get_random_secret_key
get_random_secret_key()

Link to GitHub repo

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)