Django upgrades: turn warnings on with -Wa
The Django upgrade guide suggests resolving deprecation warnings before you upgrade. They're silenced by default in Python, so you turn them on:
python -Wa manage.py test
If you're on pytest, make sure console output isn't captured, since that hides the warnings.
The order the guide recommends
Go through each feature release in turn, for example 2.0 to 2.1 to 2.2, instead of doing all the changes at once. Use the latest patch release of each. The same applies between LTS versions, such as 5.2 LTS to 6.2 LTS.
Example
Illustrative. From 5.2 LTS to 6.2 LTS you pass 6.0 and 6.1, so that's 3 steps. Give each a day for warnings, a day for dependencies and a staging run: about 2 weeks for one app.
Important
Dependencies may lag behind a new Django release, and then you wait for them. Check them first.
Upgrade prep
- β Run tests with -Wa
- β Fix warnings on the current version
- β Read notes for each release on the path
- β Check your dependencies
Gantt chart β map the steps per app β
Source: docs.djangoproject.com, How to upgrade Django to a newer version.