Skip to content

Commit

Permalink
--exclude to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
akolpakov committed Mar 11, 2016
1 parent 029f11b commit 8f71d70
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ docs/_build/

# sandbox
sandbox
tests/media
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Delete unused media files from Django project

This package provides management command `cleanup_unused_media` for Django application. With help of this command you can remove all media files which are no longer used (files without references from any model with `FileField` or `ImageField` fields or their inheritances).
This package provides management command `cleanup_unused_media` for Django application. With help of this command you can remove all media files which are no longer used (files without references from any Django model with `FileField` or `ImageField` fields or their inheritances).

# Installation
1. Install ``django-unused-media``:
```
pip install django-unused-media
```
Python 2.7, 3.3, 3.4, PyPy are supported<br/>
Django 1.6, 1.7, 1.8 are supported
Python 2.7, 3.3, 3.4, 3.5, PyPy are tested with tox.
Django 1.6, 1.7, 1.8, 1.9 are tested with tox.
2. Add ``django-unused-media`` to ``INSTALLED_APPS``:
```python
Expand All @@ -21,17 +22,29 @@ This package provides management command `cleanup_unused_media` for Django appli
# Usage
For cleanup all unused media, run:
For cleanup all unused media run management command:
```
./manage.py cleanup_unused_media
```
By default command runs in interactive mode. And before removing list of files will be displayed. User should confirm the action.
By default command runs in interactive mode. And before removing list of files will be displayed. User should confirm action.
If you would like to use this command in non interactive mode, please use option `--noinput`:
### Options
`--noinput`
Non interactive mode. Command will remove files without confirmation from user. Useful for scripts.
```
./manage.py cleanup_unused_media --noinput
```
`-e`, `--exclude`
To avoid operating on files whose names match a particular pattern. Pattern supports only `*` as any symbols. Can use multiple options in one command.
For example, to keep `.gitignore` and `*.png` files you can use:
```
./manage.py cleanup_unused_media --exclude .gitignore --exclude *.png
```
# Tests
Expand Down

0 comments on commit 8f71d70

Please sign in to comment.