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

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.

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.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

django_safe_settings-0.1.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-safe-settings-0.1.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for django-safe-settings-0.1.4.tar.gz
Algorithm Hash digest
SHA256 225d11624b1d6ee791ff54c0487893220c0a0b6789c22e29813a829ed3cdc1cd
MD5 8309a4bfa16e05446431247d92117c81
BLAKE2b-256 a8caf4078e10f39d9c33d591d497c2189647a7031f970bc3ce7b69d25a733cfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_safe_settings-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 70a968acc89d096d432bacf77d6214de4f537f705d13f005a94a41253139a473
MD5 58cd7db558f6b9993f7b0db4a589b8ca
BLAKE2b-256 35e367bc90b0964bbd80b5d8b34b5415c032a2fdb23b320c1cc7689aa33fd981

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