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.

Previous topic

The horizon.utils.units Module

Next topic

The horizon.tabs.views Module

Project Source

This Page