Skip to main content

Disposes of media files that are no longer referenced in the database.

Project description

# About

Dispose of media files that are no longer referenced in the database.

# Setup

Install with pip:

pip install git+https://bitbucket.org/danhawkes/django-dispose.git#egg=django-dispose

Add to the installed apps in `settings.py`

INSTALLED_APPS = (
...
'django_dispose'
)

Add definitions for apps and directories to search:

DISPOSE_MEDIA = {
# name of app
'app1': {
# root directory of media files in this app
'root': path.join(MEDIA_ROOT, 'app1'),
# list of subdirectories to ignore
'skip': [path.join(MEDIA_ROOT, 'app1', 'subdir1'),
path.join(MEDIA_ROOT, 'app1', 'subdir2')]
},
# another app
'app2': {
'root': path.join(MEDIA_ROOT, 'app2')
},
}

# Run

List files and prompt for confirmation before deleting:

python manage.py dispose

Alternatively, delete without prompting:

python manage.py dispose --noinput

# License

MIT - See LICENSE file.

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-dispose-1.0.tar.gz (2.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page