Skip to main content

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": "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 is passwordfortest.
  • 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 = 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

Release Time Changes Notice
v0.1.0 2020/03/01 1. First release.
v0.1.1 2020/03/01 2. Remove unused imports.
v0.1.2 2020/04/12 3. Test in django 3.2 and the unit test passed.
v0.1.3 2022/01/10 4. Fix decrypt fail silent problem.

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

django-safe-settings-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

django_safe_settings-0.1.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file django-safe-settings-0.1.3.tar.gz.

File metadata

  • Download URL: django-safe-settings-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for django-safe-settings-0.1.3.tar.gz
Algorithm Hash digest
SHA256 976747be7c9f10f0cdb59ee674725b855bb1ce0b0deb8cc30ae12861e74b752d
MD5 30c54f184398305f124603d63c4d06a5
BLAKE2b-256 04e4a88ec29368cdd3f8a28b81dbecb30bfdc5b9f241c58d8a999b87d9526d88

See more details on using hashes here.

File details

Details for the file django_safe_settings-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: django_safe_settings-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for django_safe_settings-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2f3b44f214b37f71713159d529d7be65f37659a5cb9aceec1845f0671abf4efa
MD5 3c0e995ee8ebd198134b43eeefe57508
BLAKE2b-256 b440b21d5c9d8ee94f7b32f38d82827c7ac32ca96ef3fae0ebabd7002427f1bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page