I built this website at the end of 2019 with Django 2.2 and Python 3. Then, like most personal projects, it was left alone for a long time while life and work got busy. This year the bill for that neglect arrived: the hosting platform stopped building the old Python version and announced the retirement of the stack it ran on. It was time to bring a six-year-old Django project into 2026.
The jump: Django 2.2 to 5.2 LTS, Python 3.14
Going straight from Django 2.2 to 5.2 means crossing several major versions in one step. The changes that actually broke the code were small but numerous:
- Helpers that had been deprecated and then removed, such as
ugettext,render_to_responseandis_safe_url, needed their modern replacements. - The old
STATICFILES_STORAGEsetting gave way to the newerSTORAGESconfiguration. - Logging out now has to be a POST request, so the logout link became a small form.
- Code that relied on private request internals had to use the public API instead.
None of these were hard individually. Together, they're a good reminder that "it still runs" is not the same as "it's maintained".
The dependency graveyard
The biggest clean-up wasn't Django itself; it was the packages around it. Several had been abandoned years ago and simply didn't work on modern Django: an admin theme, a reCAPTCHA field, and a long list of apps I had installed "just in case" and never really used. Some got replaced, the small reCAPTCHA field got vendored into the project, and many were deleted outright. The site now has noticeably fewer moving parts than it did in 2019.
Lesson: every dependency is a small long-term commitment. If you don't need it, don't install it.
Simplifying the infrastructure
- Static files are now served with WhiteNoise, with compression, directly from the app.
- Media (images like the ones on this blog) stays on S3 behind a CDN.
- Background tasks run inline when no message broker is configured, which removes the need for a separate Redis instance for a site this size.
What's still on the list
No upgrade is ever completely finished. Outgoing email needs a fix, because Gmail now requires app passwords for SMTP. The rich-text editor is built on CKEditor 4, which is out of support. And a few settings still need moving out of code and into environment configuration. They're tracked, and they'll get done.
What I'd do differently
- Upgrade little and often. Moving one LTS version at a time is far less painful than three at once.
- Pin dependencies, but review them yearly. A lock file keeps builds reproducible; a yearly review stops it from becoming a time capsule.
- Keep personal projects boring. The fewer clever extras, the easier it is to come back after years away.
The site is now on a supported stack and ready for another few years. This time, I plan to keep it that way.
0 Comment
-
Be the first to comment