django-upgrade
Automatically upgrade your Django project code.
What it is and what it does
django-upgrade is a command-line tool that automatically refactors Django project code to use modern syntax and APIs. It scans your codebase and applies transformations that align with newer Django versions, removing deprecated patterns and updating function calls to their current equivalents. This saves manual effort when upgrading large projects across multiple Django versions.
The tool depends on tokenize-rt for safe token-level code manipulation. It targets Django versions from 2.2 through 6.0 and runs on Python 3.10 or later. With active maintenance and broad version support, it's designed to handle the friction of keeping Django codebases current as the framework evolves.
Use it for:
- Bulk-upgrade a Django 3.2 project to Django 5.0 syntax and APIs in a single pass.
- Remove deprecated Django ORM calls and template tags across a large codebase automatically.
- Prepare a legacy Django project for a major version jump by applying intermediate upgrade rules.
- Enforce modern Django patterns in a team codebase during a scheduled maintenance window.
- Reduce manual code review effort by automating repetitive deprecation fixes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically modernizes Django project code by applying syntax and API upgrades across your codebase to match newer Django versions.
Yes. django-upgrade is actively maintained, has no security vulnerabilities, installs with minimal friction, and solves a real problem for Django teams managing version upgrades. The MIT license is permissive. Install it if you maintain a Django project and want to reduce the manual work of keeping code aligned with current Django versions.
Install
django-upgrade on PyPI
pip
pip install django-upgradeuv
uv add django-upgradepoetry
poetry add django-upgradeInstalling django-upgrade
Before you install
Low friction install with a single runtime dependency. Active maintenance with recent releases and a solid community signal (1228 stars); last commit on 2026-08-13 indicates ongoing development.
License in practice
MIT license permits use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install django-upgrade
django-upgrade --target-version 5.0 path/to/django/code
Requires Python 3.10 or later.
Verify before relying
- Specific upgrade rules and which Django versions are supported as targets beyond the framework classifiers listed.
- Whether the tool modifies files in-place or requires review before applying changes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — tokenize-rt |
| Maintenance | actively maintained — 50 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 561,754/month — #5,993 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_upgrade-1.31.1-py3-none-any.whl
Keywords: Django
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
django-clickWraps the click command-line library to let you…
permissive · top 15,000 on PyPI
django-model-utilsProvides reusable model mixins and field…
permissive · top 5,000 on PyPI
cwl-upgraderUpgrades Common Workflow Language documents…
permissive · top 15,000 on PyPI
django-lifecycleAdds declarative lifecycle hooks to Django…
permissive · top 15,000 on PyPI
django-nineProvides version checking utilities for Django,…
copyleft · top 15,000 on PyPI
djadeDjade is a command-line formatter for Django…
permissive · top 15,000 on PyPI
django-cloneDuplicates Django model instances with…
permissive · top 15,000 on PyPI
django-dirtyfieldsTracks which fields on a Django model instance…
permissive · top 15,000 on PyPI
django-deprecate-fieldsProvides a decorator to mark Django model…
permissive · top 5,000 on PyPI
django-configurationsOrganizes Django settings using composable…
permissive · top 15,000 on PyPI