Storage backend for Django that encrypts/compresses with PZip.
Reason this release was yanked:
bad packaging
Project description
django-pzip-storage
A FileSystemStorage subclass for Django that encrypts/compresses with PZip.
Installation
pip install django-pzip-storage
Usage
The simplest way to use PZipStorage
is by setting your
DEFAULT_FILE_STORAGE to
pzip_storage.PZipStorage
. By default, PZipStorage
will use your SECRET_KEY
setting as the encryption key.
IMPORTANT: Encrypting with SECRET_KEY
means you must keep SECRET_KEY
a secret, and if you lose or reset it
without first rotating the keys of all stored files, they will be lost forever.
PZipStorage
may be used with existing unencrypted files, as a drop-in replacement for FileSystemStorage
. If it
determines the requested file is not a PZip file, it will delegate to FileSystemStorage
after emitting a
needs_encryption
signal (see below).
You may also use PZipStorage
as a custom storage backend anywhere Django allows it; see
Managing Files in the Django documentation for more information.
Settings
PZIP_STORAGE_EXTENSION
- the extension to append to any file saved withPZipStorage
. Defaults to.pz
.PZIP_STORAGE_NOCOMPRESS
- a set of file extensions (with leading period) which should not be compressed when saving. SeePZipStorage.DEFAULT_NOCOMPRESS
for the default list.PZIP_STORAGE_KEYS
- an iterable (or callable returning an iterable) of keys to use. The first key on the list will be used for encrypting files. Defaults toPZipStorage.default_keys
, which yieldsSECRET_KEY
.
These settings may be overridden on a per-storage basis by instantiating PZipStorage
manually with extension
or
nocompress
keyword arguments.
Signals
PZipStorage
emits a number of signals when opening files in various circumstances:
pzip_storage.needs_rotation
- sent when a file was decrypted using an old key, i.e. not the first key in the provided list.pzip_storage.needs_encryption
- sent when an unencrypted file was opened.pzip_storage.bad_keys
- sent when an encrypted file was opened, but no keys in the list could decrypt it.
You may listen for these signals to do things like gradual encryption, key rotation, or logging.
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 django_pzip_storage-1.2.0.tar.gz
.
File metadata
- Download URL: django_pzip_storage-1.2.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e93b0d5ba93ebe395cd236ef658f62acc3b43d97e88815bff0630b15da1a93d |
|
MD5 | 3452215d41d2d4942bdd20b596ba1ff2 |
|
BLAKE2b-256 | 43fcac5856fc20b4c7e4830cc40e5f4e9cb64784345ac50b489132766675089d |
File details
Details for the file django_pzip_storage-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: django_pzip_storage-1.2.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 893feed8bdf5d5e50780a0d827863cde7bcb617d1f67c685ecf8d83b88c88bf1 |
|
MD5 | 7db644036d9169b7bd44b9ae1aed6b26 |
|
BLAKE2b-256 | 3a9eb7b28d0f9489907c0243bc34fbc61fe0dcf38379b1c0176bce33ce15e5c0 |