Skip to main content

A reusable Django app for purging database records (e.g., logs).

Project description


Build Status Documentation Status PyPI Coverage Report




Purge is a reusable Django app for regularly purging old database entries, like logs.

The Problem: Tables/models like sessions and logs can grow without limit.

The Solution: This app allows you to schedule database purging of old records. You can also make FilePurgers which can purge old files based on datestamps in the filename or timestamps in the meta-data (atime/mtime/ctime).

How to Use

$ pip install django-purge

Include purge in your INSTALLED_APPS. Then, create your database purgers or file purgers in the admin interface.

Then, either periodically call the purge management command (e.g., via a system cronjob), or install and configure django-cron (add purge.cron to your CRON_CLASSES in your The builtin CronJob class is set to run every 4 hours. You can change this by altering your and adding PURGE_CRON_RUN_AT_TIMES to an array of times you want to run the job at (e.g., ['1:00'] to run at 1am).


Email if you want to contribute. You must only contribute code that you have authored or otherwise hold the copyright to, and you must make any contributions to this project available under the MIT license.

To collaborators: don’t push using the --force option.

Dev Quickstart

Purge comes with a file, technically making it a Django project as well as a Django app. First clone, the repository into a location of your choosing:

$ git clone

Then you can go into the django-purge directory and do the initial migrations and run the server (you may need to type python3 rather than python):

$ cd django-purge
$ python makemigrations
$ python migrate
$ python createsuperuser
$ python runserver

Then you can see the models at

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-purge-1.0.0.tar.gz (7.8 kB view hashes)

Uploaded source

Built Distribution

django_purge-1.0.0-py3-none-any.whl (11.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page