Django application let you write your database password settings in an encrypted way.
Project description
django-safe-settings
Django application let you write your database password settings in an encrypted way.
Install
pip install django-safe-settings
Usage
pro/settings.py
INSTALLED_APPS = [
...
'django_safe_settings',
...
]
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"HOST": "127.0.0.1",
"PORT": 3306,
"NAME": "project_database_name",
"USER": "project_database_username",
"PASSWORD": "e7293477f3fa2a72935913624eecdeb5",
"OPTIONS": {
"init_command": """SET sql_mode="STRICT_TRANS_TABLES" """,
},
},
}
...
## ##################################################################
## this must be at the bottom of settings.py
## ##################################################################
from django_safe_settings.patch import patch_all
patch_all()
- Set sensitive configuration items to encrypted values, e.g.
PASSWORD=e7293477f3fa2a72935913624eecdeb5
, the real plain value ispasswordfortest
. - Use
python manage.py django_safe_settings_encrypt PLAIN_DATA
to get the encrypted value, e.g.C:\git\django-safe-settings>python manage.py django_safe_settings_encrypt passwordfortest plain value = passwordfortest encrypted value = e7293477f3fa2a72935913624eecdeb5
- We use fastutils.cipherutils.AesCipher for encryption, and the password is related to Django's SECRET_KEY, so when the SECRET_KEY's value changes, the encrypted value must be regenerated.
- You can use encrypt values anywhere in Django's settings.
Releases
Release | Time | Changes | Notice |
---|---|---|---|
v0.1.0 | 2020/03/01 | 1. First release. | |
v0.1.1 | 2020/03/01 | 2. Remove unused imports. |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-safe-settings-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f7125872b2f8dbb3c60f6c8a9ec4e86e1a8c70289045c5021480bb536ef8332 |
|
MD5 | 02f5b79891586599b96a183e5aed4af2 |
|
BLAKE2b-256 | 8f3b35627e512e0eda49260328c1e4db5abe2db7b6e00e4b2d0fd7f1923f68f5 |