DJANGO OUTBOX ENCRYPTION
Project description
DJANGO OUTBOX ENCRYPTION
Use For Encrypt Environment Variable and Other Encryption Purpose.
Install to your environment : > pip install outbox-encryption
How to use :
This code for create .env.client file
Test using python shell :
> python manage.py shell
Encryption Process :
> from encryption import OutboxEncryption
> lib = OutboxEncryption()
> mplaint_text = {
'DB_PASSWORD': '',
'SECRET_KEY': 'xxg_7me8rl2m#a_h2oresgt2#ni=3_4*!ai*=rtsq)yi!g7_5-51xx'
}
> lib.encrypt_environ('.env.local', mplaint_text)
> print('Show Hidden File to Show .env.local') # file .env.local is created
Decryption Process :
Run inside settings.py (django project settings)
> lib.set_keyword_local('env_outbox_encrypt') # this is use for local environment, env_outbox_encrypt only exists in local, not in server
> mplaint_key = list(mplaint_text.keys()) # List of key variable that must be encrypt decrypt before set or get data
> mplaint_list = ['ALLOWED_HOSTS'] # variable that must be cast as list from environmnet to settings.py
> mplaint_tuple = ['SECURE_PROXY_SSL_HEADER'] # variable that must be casr
as tuple from environment to settings.py
# mplaint_list and mplaint_tuple is optional
> lib.decrypt_environ(mplaint_key, mplaint_list, mplaint_tuple)
# Inside settings.py
> from encryption import OutboxEncryption
> mplaint_key = ['DB_PASSWORD', 'SECRET_KEY']
> mplaint_list = ['ALLOWED_HOSTS']
> mplaint_tuple = ['SECURE_PROXY_SSL_HEADER']
> dict1 = lib.decrypt_environ(mplaint_key, mplaint_list, mplaint_tuple)
> DEBUG = dict1['DEBUG']
> UNDER_CONSTRUCTION = dict1['UNDER_CONSTRUCTION']
> DEBUG = dict1['DEBUG']
> SECRET_KEY = dict1['SECRET_KEY']
> ALLOWED_HOSTS = dict1['ALLOWED_HOSTS']
> DATABASES = {
'default': {
'ENGINE' : dict1['DB_ENGINE'],
'NAME' : dict1['DB_NAME'],
'USER' : dict1['DB_USER'],
'PASSWORD' : dict1['DB_PASSWORD'],
'HOST' : dict1['DB_HOSTS'],
'PORT' : dict1['DB_POST'],
}
> SECURE_PROXY_SSL_HEADER = dict1['SECURE_PROXY_SSL_HEADER']
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file outbox-encryption-1.0.2.tar.gz
.
File metadata
- Download URL: outbox-encryption-1.0.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e069031bf2605471cae4ec99dc90e1778781043fead7b002dce18dd9279e5e8f |
|
MD5 | d52f82bdc7b3cfbd74d94a6f6a49255e |
|
BLAKE2b-256 | 64fd47d68620ca751a18bbb917e2c034f320a9419c849c8e47465ffba03c83d2 |
Provenance
File details
Details for the file outbox_encryption-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: outbox_encryption-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de63c5ac5e0dd5a0578adbaa56fb09738ddaa98be09ed1406a9af3b73245f3a9 |
|
MD5 | 900d12ebd61ed62e29532b17115e9a1f |
|
BLAKE2b-256 | 24cbaeef511d8743649df3f0d6325590dd91c69b5e6ca8e484d28b220003dd17 |