The horizon.utils.secret_key ModuleΒΆ

exception horizon.utils.secret_key.FilePermissionError[source]

Bases: exceptions.Exception

The key file permissions are insecure.

horizon.utils.secret_key.generate_key(key_length=64)[source]

Secret key generator.

The quality of randomness depends on operating system support, see http://docs.python.org/library/random.html#random.SystemRandom.

horizon.utils.secret_key.generate_or_read_from_file(key_file='.secret_key', key_length=64)[source]

Multiprocess-safe secret key file generator.

Useful to replace the default (and thus unsafe) SECRET_KEY in settings.py upon first start. Save to use, i.e. when multiple Python interpreters serve the dashboard Django application (e.g. in a mod_wsgi + daemonized environment). Also checks if file permissions are set correctly and throws an exception if not.

horizon.utils.secret_key.read_from_file(key_file='.secret_key')[source]

Previous topic

The horizon.utils.validators Module

Next topic

The horizon.utils.csvbase Module

Project Source

This Page