Django Secret Settings is a Django application allowing for convenient creation&retrieval of encrypted secret keys.
Install using pip:
pip install django-secret-settings
Then add 'django_secret_settings'
to your INSTALLED_APPS
, import django-secret's 'SecretsEnum'
and define your secrets.
from django_secrets import SecretsEnum
INSTALLED_APPS = [
...
"django_secret_settings",
]
class ExampleSecrets(SecretsEnum):
SECRET_TYPE_1 = 1
SECRET_TYPE_2 = 2
DJANGO_SECRET_VALUES = ExampleSecrets
You can access your secrets anywhere in code by:
>>> from django_secrets import secret_settings
>>> some_decrypted_key = secret_settings.MY_KEY