# un1t/django-cleanup

Automatically deletes old file for FileField and ImageField. It also deletes files on models instance deletion.

Repository: https://github.com/un1t/django-cleanup
Canonical: https://ross.abutalabs.com/products/django-cleanup
Language: Python
License: MIT
License Family: permissive
Last push: 2025-06-05T22:10:48+00:00

## Health v2 (maintenance only)
Score: 44/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 25, release rhythm 35, longevity 100
- inputs: {"age_days": 5132, "days_push": 454, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1212, forks 79 (observed 2026-08-28T04:04:00.326520+00:00)

## What it is
A Django app that automatically deletes old files for FileField and ImageField when their values change or when the model instance is deleted. It works via Django signal handlers and transaction-aware file deletion.

## Use cases
- automatically delete old files when a FileField is updated in Django
- remove uploaded images when a Django model instance is deleted
- clean up orphaned media files from Django models
- prevent stale uploads from accumulating on disk
- manage file lifecycle for Django ImageField models

## When to choose
- you use Django's FileField or ImageField and want automatic file cleanup
- you want a zero-configuration app that hooks into Django signals
- your database supports transactions and you need safe file deletion on rollback

## When to avoid
- you use a database without transaction support
- your models are not properly loaded in models.py
- you need cleanup for non-Django file storage outside the ORM

## Facets
- artifact type: library
- maturity: stable
- function: file-system, middleware
- domain: web-development, backend, files
- platform: python
- tags: django, filefield, imagefield, file-cleanup, orm-signals

## Member repositories
- un1t/django-cleanup (main) score 44

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:00.326520+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:18:01.727419+00:00, confidence not recorded.
  - readme: https://github.com/un1t/django-cleanup (fetched 2026-08-28T04:04:00.326520+00:00, sha bab1b3853715)
  - registry_pypi: https://pypi.org/pypi/django-cleanup/json (fetched 2026-08-29T12:25:58.910908+00:00, sha ec866ee2ab89)
- Data as of 2026-08-30T08:39:29.467469+00:00.
