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. |
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
File details
Details for the file django-safe-settings-0.1.0.tar.gz
.
File metadata
- Download URL: django-safe-settings-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea91bd78aab14f8bd5bd808f19491506b5bd0d3e8eae4b269749bc961b2ba694 |
|
MD5 | ae2ede11500eb997a6b660dc8595ca8e |
|
BLAKE2b-256 | e3ce08ca50ebcf61ff17a1d5293f0f15bde11c9b77a19fb0a080d1cb658327ed |