Giter Club home page Giter Club logo

django-orphaned's Introduction

about

Delete all orphaned files

setup

install via easy_install or pip

easy_install django-orphaned

with pip

pip install django-orphaned

add it to installed apps in django settings.py

INSTALLED_APPS = (
    'django_orphaned',
    ...
)

now add this to your settings.py ('app1' and app2 are the app names where models.py is located):

ORPHANED_APPS_MEDIABASE_DIRS = {
    'app1': {
        # MEDIA_ROOT => default location(s) of your uploaded items e.g. /var/www/mediabase
        # It can be a single value or a list of iterable
        'root': ( 
            os.path.join(MEDIA_ROOT, 'files'),
            os.path.join(MEDIA_ROOT, 'images'),
        ),
        # optional iterable of subfolders to preserve, e.g. sorl.thumbnail cache
        'skip': (               
            path.join(MEDIA_ROOT, 'cache'),
            path.join(MEDIA_ROOT, 'foobar'),
        ),
        # optional iterable of files to preserve
        'exclude': (
            '.gitignore',
        ) 
    }
    'app2': {
        ...
        # same as above
        ..
    }
}
# location where the log file will be stored
# if not set or empty the log file will not be created
ORPHANED_LOGS_DIR = MEDIA_ROOT

NOTE: from version 0.4.2 you can define ''root'' as string or iterable (list, array)

the least to do is to run this command to show all orphaned files

python manage.py deleteorphaned --info

and to finally delete all orphaned files

python manage.py deleteorphaned

license

MIT-License, see LICENSE file.

django-orphaned's People

Contributors

artscoop avatar joerick avatar ledil avatar leonardogentile avatar slamora avatar tilley avatar zlorf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.