There are a few ways to tackle upgrading your Django project.
The easiest way to upgrade your Django site is to do it one release at a time. If you’re on 2.1.x, that would be 2.2.x, or if you’re on 2.2.x you would need to move to 3.0, for example.
This is the simplest path because the Django release notes highlight, many, if not all, of the breaking changes in each release for you. You can follow along with the changes in small, incremental steps.
If you’re relatively up-to-date and just a little bit behind, this is the path to take.
However, if you’re several years out of date this can be slow and painful.
Slow because you will be touching many of the same files MANY times, making these tiny incremental changes for each version.
The other issue you will run into is your third-party pip dependencies. These also often need to be updated as you move major, and sometimes minor, Django versions. If you work a release at a time, you may find yourself updating specific libraries more than once before you land on your final version.
Please keep in mind when we are talking about versions here, we’re talking about minor and major version changes. If you’re on 2.2.1 and 2.2.2 comes out, a patch version, you should be able to switch the version in your requirements and have it work without any code changes 99.99% of the time.
Instead of upgrading to each version individually, you can choose to jump a few versions simultaneously.
This can be a faster method for developers who are more familiar with Django and how it has changed over time.
However, the downside is that the error messages and exceptions you run into will be multi-layered. You will often immediately fix one error to uncover the next underlying upgrade issue.
Not the best path for less experienced Django devs.
Obviously, one option is to jump from your current version to the latest release or latest LTS version.
We only recommend this if you’re VERY familiar with Django, how it has changed over time, and the third-party libraries you’re using.
You won’t find many of “How to upgrade from Django 1.9 to 4.1” blog posts and even StackOverFlow messages along those lines are fairly rare.
You could think of this as the lazy option, but often it’s the wisest option.
Find a trusted developer or consultant who has experience upgrading many Django projects and pay them to do it for your team. They will be able to do it more quickly as they have prior experience with other projects. Leaving your team with more time to focus on your core business needs.