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": "enc: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=enc:e7293477f3fa2a72935913624eecdeb5, the real plain value ispasswordfortest. - Use
python manage.py django_safe_settings_encrypt PLAIN_DATAto get the encrypted value, e.g.C:\git\django-safe-settings>python manage.py django_safe_settings_encrypt passwordfortest plain value = passwordfortest encrypted value = enc: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
v0.1.0
- First release.
v0.1.1
- Remove unused imports.
v0.1.2
- Fix problems in django 3.2.x.
v0.1.3
- Fix decrypt fail silent problem.
v0.1.4
- Doc update.
v0.1.5
- Doc update.
Metadata
Release files for django-safe-settings 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_safe_settings-0.1.5.tar.gz | 4.4 kB | Without provenance | Details for django_safe_settings-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_safe_settings-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for django_safe_settings-0.1.5-py3-none-any.whl |
Total release size: 9.8 kB
Release files / django_safe_settings-0.1.5.tar.gz
| Download URL | django_safe_settings-0.1.5.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e8d18c70e2b8cbb81bfb4aa7c6bd9686e5bdc6626d32cb656924c6b656d31b2
|
|
BLAKE2b-256 checksum How to use checksums |
aef8685139733193f2cc7f15b5f1ffc7c515dc53ee2a38807fd317a6b9c1eefa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / django_safe_settings-0.1.5-py3-none-any.whl
| Download URL | django_safe_settings-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34a01263087f29d508888c6e3e1628b8811c8637ba3097241d016b24c0fa4b7b
|
|
BLAKE2b-256 checksum How to use checksums |
3404201fcc9d5793b6129c7125c7d366151c90923dadd7ae33bccac03a7ad21f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Security for django-safe-settings 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.