This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django Datapurge

Simple app to help purging old data like sesions, nonces, logs etc.. It’s like django-admin.py clearsessions command but gives you possibility to purge anything. Simpliest way to use datapurge is to run management command (manually or via cron):

python manage.py purge

It’s easy to integrate datapurge with celery or kronos. Just wrap datapurge.actions.purge function with code corresponding to your task backend and run it the way you want.

Requirements

  • Python (2.6, 2.7, 3.4, 3.5)
  • Django>=1.3.7

Installation

Install from PyPI using pip:

pip install django-datapurge

Or clone this repo:

git clone git@github.com:swistakm/django-datapurge.git

Add 'datapurge' to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    ...
    'datapurge',
)

Configuration

Add DATAPURGE_MODELS to your settings file and specify which models should be purged:

DATAPURGE_MODELS = {
    'app_name.ModelName1': {
        # policy settings
        ...
        },
    'app_name.ModelName2': {
        ...
        },
}

Available purge policies

There are a few available policies for your use. Use what you find most convienient. Policy is guessed from set parameters provided.

ExpireFieldPolicy

Deletes all objects which expire_field datetime is older than timezone.now().

Parameters:

  • 'expire_field' - name of datetime field holding expiration date

Example:

DATAPURGE_MODELS = {
    "sessions.Session": {
        "expire_field": "expire_date",
    }
}

LifetimePolicy

Deletes all objects which are older than specified lifetime

Parameters:

  • 'lifetime' - timedelta object specifying maximum lifetime of object
  • 'created_field' - name of datetime field holding object creation time

Example:

from timezone import timedelta

DATAPURGE_MODELS = {
    "oauth_provider.Nonce": {
        "lifetime": timedelta(seconds=300),
        "created_field": "timestamp",
    }

CallablePolicy

Deletes all objects from query returned by provided callable

Parameters:

  • 'callable' - function accepting model class and returning QuerySet

Example:

DATAPURGE_MODELS = {
    "some_app.Log": {
        "callable": lambda model: model.objects.all(),
    }
Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_datapurge-0.0.2-py2.py3-none-any.whl (13.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Apr 7, 2016
django-datapurge-0.0.2.tar.gz (8.0 kB) Copy SHA256 Checksum SHA256 Source Apr 7, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting