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