Installation
For filesystem storage (default):
pip install django-prune-uploads
For S3 storage backends:
pip install django-prune-uploads[s3]
Then add prune_uploads to your INSTALLED_APPS.
Usage
Run ./manage.py prune_uploads and have a look at the output (does not change anything in the database or the file system!)
Run ./manage.py prune_uploads -v2 for a potentially much more verbose report.
Run ./manage.py prune_uploads --help to learn about the available options for actually changing and/or removing files and records.
Storage Backend Support
This package supports both filesystem storage and S3-based storage backends:
Filesystem Storage
For projects using Django’s default FileSystemStorage, the command uses os.walk() to enumerate files in the MEDIA_ROOT directory.
S3 Storage
For projects using S3-based storage backends (such as django-storages with S3Boto3Storage or django-s3-storage), the command automatically detects the storage backend and uses boto3 directly to enumerate files. This is significantly faster than using Django’s storage API when dealing with buckets containing many objects.
The command will automatically detect S3 storage backends and use the appropriate enumeration method. No additional configuration is required beyond installing the s3 extra dependencies.
Release files for django_prune_uploads 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_prune_uploads-0.3.1.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_prune_uploads-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / django_prune_uploads-0.3.1.tar.gz
| Download URL | django_prune_uploads-0.3.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ce0cda88179ff52c4fc71f08c8113b5f4a633b77ef715f962487e24a94f4bda
|
|
BLAKE2b-256 checksum How to use checksums |
4df5be3510e756fbfcacc3685cd323bedc462dd1844cedca36d6ba29e35eeab3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / django_prune_uploads-0.3.1-py3-none-any.whl
| Download URL | django_prune_uploads-0.3.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66c23107a1f297c04c571f57f6545bab7eb64f637d72f83da549e92b4fc858d2
|
|
BLAKE2b-256 checksum How to use checksums |
cd7672553ea6845c0abdaae66e3bf76a92bad0e1e8dfd08a3ce3c35034fdccb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|