Skip to main content

A quick, rough around the edges Django application to remember and remove temporary files.

Project description


A quick, rough around the edges Django application to remember and remove temporary files.

The purpose of this application is to allow the user to create a temporary file (e.g. for the purpose of streaming or to allow a time limited availability) and automatically remove it after a given period of time.

At present this can be done automatically using the provided middleware, manually by running the cleanup_later management command, or by calling the CleanupFile.cleanup() function directly.

It's been developed and tested on Python 3.7 and Django 2.2 .. your mileage may vary with other configurations.


Install via pip or download the repository:

pip install django-cleanup-later

Add the app to your INSTALLED_APPS setting:


Make sure to migrate: migrate

And optionally add the middleware if you want files to be removed automatically without the need for a cron or background process:


Note that using the middleware probably isn't the most efficient approach. If your project is using a cron or celery for background processing, it's more efficient to run the cleanup from there.


To use the app, simply register the filename you would like to later cleanup like so:

from cleanup_later.models import CleanupFile


By default, files will be deleted after 10 minutes, but you can override this by specifying a validity parameter as a timedelta .. e.g.

CleanupFile.register('file_to_delete.txt', timedelta(minutes=30))



Pull requests are welcome if you find this library useful.

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-cleanup-later, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-cleanup-later-0.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page