Sitesecret is a tiny library to generate and store per-site secrets.
Stop doing this:
SECRET = 'my-top-sekrit-key'
And do this instead:
import sitesecret SECRET = sitesecret.get_secret(__name__)
SECRET will be initialized with 1024 octets of random data, suitable for cryptographic applications. The data will be saved in the current directory in a file named .sitesecret-<module name>.
Subsequent calls will return the same secret value and sitesecret ensures that only a single secret is ever generated — even if multiple processes call get_secret at the same time .