Upgrading from Django 2.0.1 to latest

Hi everyone

I’ve inherited an internal legacy backend system that is running Django 2.0.1. Now I would like to (have to) upgrade it to the latest version.

The documentation recommends going by small steps. So from 2.0.1 to 2.0.2, … and so on. However, is this advice applicable for an old version like this?

What would be the past of least resistance upgrading to the latest version?

<opinion> It really depends in a large part upon the size and complexity of the system. </opinion>

I’d say doing it that way absolutely minimizes the risks and the chances of encountering an unpleasant surprise - at the expense of such a migration taking significantly more time.

I’ve moved a couple of (admittedly-trivial) Django 1.8 systems directly to 2.2, where the only issue was making the code Python 3-compliant. (I’m sure there were a couple other changes as well, but they were quickly resolved.) The two systems were both migrated the same day.

Assuming a not-very complex or intricate system, I’d be tempted to try going from 2.0.1 to 2.0.<last> to 2.2.<current> to 3.2.<current> - but ready to quickly abandon that sequence upon encountering the first non-trivial error.

You might also want to take the time to review the release notes between the releases you’re moving to see if there’s anything that might appear to cause a problem.

Beyond that it does really come down to your judgement regarding your experience and comfort working with Django, knowledge of the system being migrated, the “quality” of that system (are there unit tests for the major components?), and willingness to pivot and change plans on the fly.

The advice is not like that. It’s from 2.0 to 2.1, then 2.1 to 2.2, etc. So still a few upgrades but not bazillions.

The patch numbers (the last ones) contain only bug fixes. If you’re running e.g. 3.2 you should still regularly upgrade to the latest path release, perhaps even when they come out. For example all projects using any 3.2 version should upgrade to 3.2.5 as of yesterday’s security release.

As for opinion - Ken’s “it depends” answer is bang on. Don’t forget that the third party Django packages you install all count as part of the system you’ll need to upgrade. You can often run into problems with unmaintained packages that you will need to update yourself or replace.