Back to the video

Keeping Pace with Django: Evolving Through 15 years of Updates with Eduardo Felipe Castegnaro

Transcript

By Eduardo Felipe Castegnaro, Speaker 2, Speaker 3. From DjangoCon US 2026. Published October 26, 2026.

Watch the video Markdown version 3,727 words · auto-generated · en

Transcript

Automatically transcribed, so expect mistakes in names and technical terms. Filler words are removed.

Eduardo Felipe Castegnaro

Good afternoon, everyone. I'm Eduardo. I am the technology director for a company called OnSign. I kind of started as an intern somewhere, and twenty years later I'm still at the same company, working on the same software. So I thought that maybe sharing this experience, which can be quite unique, might be useful to someone else. Let me just briefly go through how it all started. In 2005, I started computer science, and then I joined a software company that did hardware. So, as an intern, does anyone know what CentOS is? Old enough? Oh, there's a few. So I started working on customizing the installer for it.

It's called Anaconda—not the software, not the science thing. It's a different Anaconda; multiple Anacondas. So it was written in Python 2.4. At that time, my university was all Java, and I really didn't like it. So when I started web development, I thought, hey, Django looks cool and it's in Python, so let's get started. A couple of years later, I started into Google Summer of Code, and I worked for a project called Review Board, which did software reviews before GitHub PRs were a thing. That's when I really started picking up Django and getting to know all the features.

And then I graduated. I became a tech lead at the same company that I interned at, and around 2011, we decided to try three different products. They were all web development products, and only one of those really worked. I still work on it, and it's called OnSign. Here is the first commit for OnSign, and I'm really, really pissed that it's actually not my name up there. I was the first committer on one of those that did not work. A couple of weeks later, I actually did my first commit for OnSign, which you can see here.

And it's like seeing a version of the past, something from a different era. Do you remember a time before Django had swappable user models? Oh, those times were rough. So, this is basically all the Django releases we've been through on OnSign. We started here, with Django 1.2, and we've been through 21 releases down here at 5.2. So that is 15 years and a lot of versions—21 versions.

Well, because we are a business and not an open source project, we have to balance our attention between changing and updating our tools and actually making new features available for our users. So what happened is, around 2016, we decided that we would only do LTS. We started skipping updates. We didn't do the point-two releases: 2.0, 2.1; we only did 2.2, and so on. Unfortunately, Natalie already spoiled my part where we're going to talk about the new release schedule, but hey.

So, one thing that's very particular, and that I keep hearing again and again—five minutes ago, Elizabeth just mentioned that we do things that are messy and weird—is that OnSign is a CMS, and people use it to organize and display content on screens all around the world. In 2014, something that was really in demand was the ability to put a playlist inside of a playlist so they can show their content and keep it organized. This maps really well to a recursive common table expression, which Elizabeth called messy, and it is messy.

but it also works really great. So One thing that doesn't really work is it doesn't really work with Django's ORM. It it's it is kind of on the side and you know there's a ticket for adding support. for about nine years and hey I've been working on this project for 15 so I can do another 15 years no problem and one thing that that we do use a lot is we use a lot of queries at raw and extra and cursor execute. We had a member of the steering council a couple of years ago write us on a thread that said that maybe we would

And in 1.3, we got TemplateResponse, which was amazing. In 1.4, time zones—you have no idea how much we needed time zones. Then we had swappable user models, and we had migrations. We had South before. I'm not sure. Hey, raise your hands, who remembers South? Oh, Andrew. Andrew is my hero. Then in 1.8, we had raw SQL and ArrayField, both things that we use extensively in our codebase, and a GinIndex field, and an array aggregation, and then Subquery, Exists, the GinIndex—we don't have to make it by hand—bulk updates and filtering on raw SQL.

The guy who wrote the PR is my personal hero. I pray to him every day. This eliminated so many annotating filters in our codebase, you would not believe. And then we could completely remove our write-disk cache and use the native one. I am really looking forward to CSP and fetch modes. Those are the top things for me. And this is the thing: every single time it evolved, we also got a better codebase. The first time we needed an extra was in 2012, like one year after we started. Then we were able to replace most extras with RawSQL.

In 2016, when it was introduced, we were able to replace some raw SQL with subqueries. Then, when it was allowed in filter, it was amazing. The last time we actually had to add an extra to a QuerySet in Django was 2022, four years ago. This is great. And the thing is, with the new release cycle, you really get to enjoy and update much faster, because right now, like I said, we tend to wait for LTS releases to actually go to the new version. Now we'll be able to pick and choose the best time to migrate. Natalia mentioned today that this new release cycle is going to make it easier for people to adopt new versions of Django.

And I agreed and was like, yes, people like me. So, okay, now that I told you the backstory of everything, how do you actually go about bringing a project all the way from 1.2 to 5.2, 21 releases? You just read the release notes. That's the gist of it. If you come out of this talk with one thing in mind, it's just read the release notes. They're actually quite detailed. There's a lot of information there, and I don't know if I'm kind of weird, but I also think they're fun.

There are sometimes little jokes here and there, and things like, oh, I like that. When I read the release notes, I also feel like opening a box of new toys. And, like any child of a new age must know, you have to let go of some toys to make space for new toys. So that's where the four sections come in—the four sections that are in every single one of the release notes: what's new, backward-incompatible changes, features that were deprecated, and features that were removed. So I'm going to talk a little bit about each one of them and how they affect our codebase.

The first, what's new: they are like the new toys. I'm going to bring up something that was new in 2013, but it was new for us. When we started doing single sign-on for our platform, we needed a way to log users out of all sessions. By then, we were already using Redis to hold our sessions. This is actually code from over ten years ago. We used the signal when the user logged in. We recorded the session key in a list of sessions. Then, when the user logged out or requested to be logged out of every single session, we just iterated over the list and deleted the session.

Messy, but it worked. And then, in Django 1.7, under the minor section of what's new—the minor section is my favorite. Actually, miscellaneous is my favorite, because there's so much good stuff there—in the minor section, there was this little text saying that AbstractBaseUser.get_session_auth_hash lets you invalidate all sessions of a user at once. So here we were able to just delete all that messy code and replace it with a simple method on our user that says, okay, the last logout, which is the single sign-on logout, is now part of our session hash. If someone logs the user out, the session hash changes and they're logged out of everything.

So now we go to the next section, which is the backward-incompatible changes. This is like, okay, if you deploy this new version, it's going to break production, and you should really pay attention, because usually this is the sad part. This is the part where they say, oh, you know, your version of Postgres that you love so much is not supported anymore. Or maybe you really like MariaDB 10.2. Nope, not going to go.

So this is where you actually have to do a lot of work, maybe not necessarily on Django itself, but on your whole infrastructure, to be able to bring your project to the new Django version. This usually takes a lot of planning on our side. We try to minimize our downtime. We've been live-migrating Postgres from 9.5 up to Postgres 17, which is the latest version that we're currently running. This is something that's not Django-related, but it's related to the project, right? This is the sad part, but I understand. We don't want to be a burden on the Django community by asking it to support really old versions.

So the next part is features that are deprecated. This will break production when they're removed, just not right now. This is much more related to Django's APIs themselves, not external packages or dependencies, but really Django. And this is the thing: Django has a deprecation policy. It's live; you can just go to the deprecation policy, and it will say something like this: something that was deprecated in version 4.2 will be removed in 5.1. In 5.0, it will still work with a warning, and in 5.1...

In 5.1, it will be completely removed. But here's the thing: the deprecation policy is still being adjusted for the new release cycle. Currently, if you go there, you'll see that it mentions things that will be removed in Django 7.1, which will never exist. This is a mysterious version of Django. It's going to be Django 2028. As a whole, we've gained so much, because right now, depending on when each feature was deprecated, you might have two years or four years to remove it. If it was deprecated in a long-term support release, then you have a lot of time. If it was deprecated in a minor version, you have less time.

So with the new release cycle, you actually always know that you have the current version and the next one. So, potentially, you have a total of four years of using this deprecated feature until it is actually removed in the next one. Something deprecated in 2028 will only be removed in 2030. This is a little piece of our codebase where Django 3.1 deprecated the URL method and replaced it with path and re_path. So we went around and changed everything. This was quite easy to change. That was just a minor duplication.

So with the new release cycle you actually always know that you have the current version and the next one. So a total of Potentially four years of you using this deprecated feature until it is actually removed in the next one. So something deprecated in 2028 will only be removed in 2030. And this is something that we a piece of our a little piece of our code base that Django 3. 1 deprecated the URL method and replaced it with a path and repath. So we went around and changed everything. This was quite easy to change. That was just a minor duplication.

Some can get a little bit messy, but it's usually quite simple. Now comes the sad part, when the features are actually removed. If you did everything well, you don't have to be really worried here, because the features are only removed a couple of years after they are deprecated. And if you're keeping up with Django and updating it, then you won't be using them anymore; you won't be getting any warnings. But when they are deprecated, you will not get a warning; you will just get a broken website. So here, if you do everything right, no worries, but you see...

We don't necessarily do everything right. Sometimes a few things slip by. So this is now what we actually do for real. This is the real PR that was done in April this year when we migrated to Django 5.2, and it says everything that was deprecated and everything that was cleaned up. One of the commits was actually about something that was removed in 5.0. We should have updated it when we went to 4.2. Like I said, it would be less work for ourselves. But somehow we didn't, and then during this update, when it was actually removed...

We went ahead and changed this. We read all the release notes, and every single deprecation becomes a different commit. We do the PR, and that's how we actually manage to bring Django up to date. Usually, that works really well, and I just want to tell you about the one time in 15 years that a point release had a change that broke us because it was not mentioned anywhere else. So let me set the stage. Okay, so on 3.1.1, in the release notes down there, there was something that said, okay, we fixed...

The QuerySet.order_by on a JSON field that had a custom decoder. And as a consequence, this is the important part here: JSON fields with raw SQL now return a string instead of preloaded data. You will need to explicitly call JSON loads in such cases. And do you remember what I said before? We have a lot of raw. This one was not present at all. When we went to 3.2, it was not mentioned in the 3.1 and the 3.2 that we read, not mentioned anywhere else. And the thing is, the 3.2 was relatively...

Light in terms of deprecations. So it was an easy upgrade for us, and everything seemed fine until we deployed to a staging environment and it broke in a few hours, when one of those recursive CTE queries was hit. And that's the thing. Sometimes we actually have to agree to disagree. All the talks here talk about developing Django as a framework, and on the point of the developers of Django, I do agree that you have to look out for everyone. And you have to look out for all the use cases and...

And those that don't have as much technical means as we do as a company. So the decision must be made for pretty much everyone. But that doesn't mean that the decision is right for us in particular. And it is on us. So we know that if something breaks due to our monkey patching of Django, it is on us to fix it. But we have been running this in production for over four years, and nothing broke until now. So fingers crossed, it will just keep monkey patching it away. And we have actually cataloged seven different monkey patches on top of Django for different things. And a few of those we already discussed in the mailing list...

Or in the track. And we had Django steering council members telling us, “Oh, this is not something we are interested in offering our users.” That's fine with us. We just keep monkey patching it away. So what did we learn from this? Well, if you work 15 years on a project, you will reap what you sow. And that is the thing. If you just do a project for three years and then you move on, you actually will not be able to follow Django for that product long enough. And...

But if you do put in some time, you can bring and update your codebase. And Django, really, we have views that are 15 years old and work perfectly right now. In our world of technology, which moves so fast and has so many changes happening, having a piece of code working all this time for 15 years in production is really mind-boggling to me. And when you're doing the update, by default, deprecation warnings are not shown. So you should really run with deprecation warnings turned on, with Python warnings turned on, so you actually know every single warning that you get.

And I would say that you should stick to an LTS release to ease your maintenance burden, but actually, with the new release cycle, I'm not sure if that works anymore. You just update when it's convenient to you, because everything is an LTS. And then you should keep looking for new features because they simplify your code and they can make a lot of your life easier in the future. I do intend to keep working on this project for, I don't know, the next 10 years. So I am really careful about the codebase and how we maintain it, and making sure that it is readable in the future, when...

My mind doesn't work anymore and my memory of everything is not as sharp as it was. So that's it for me. Thank you for all your time. I hope you enjoyed something.

Speaker 2

Oh, I have one. The talk was about your experience going with the updates of Django, but what about the other dependencies?

Eduardo Felipe Castegnaro

Yes, we do have to vendor a few dependencies because along the way some dependencies just stopped being updated, and we have to replace them or vendor them. We usually try to replace them, but sometimes a dependency that we really like is kind of abandoned. And then we just fork the project on GitHub, and we keep sending updates and use our own version. We don't try to make a public release, but the code is there, and it's what we use in production.

Speaker 2

Thank you.

Speaker 3

Hi, thanks for the great talk. I was pleased to hear you speak about how much you enjoy the release notes. And so my question for you is: would you like more of them? For instance, we often don't document bug fixes if nothing has been broken recently. If it's something that's never been handled exactly correctly since it was introduced, and all we're doing is bringing the behavior into alignment with the docs, we often just skip the release note. Unless we can anticipate somebody's probably relying on that, quote, “wrong” behavior, then we'll slip in a release note somewhere. So there's a judgment call. We could make the release notes even longer, but does that make them less usable? I'm curious for your perspective.

Eduardo Felipe Castegnaro

Yeah, the thing is, you already do a lot of internal things in the release notes. I'm not sure if everyone reads the release notes, but you already do things like, “Oh, this internal method is now deprecated,” which shouldn't even be a thing. It's an internal method. But from the point of view of a user, the more the merrier. I guess we are not able to discern all the side effects of that bug fix in particular in 3.1.1. So I don't think the miscellaneous section can be quite big enough. The miscellaneous can always grow. There's a lot of miscellaneous there.

Speaker 2

Well, thank you from the organization. This is good for you.

Eduardo Felipe Castegnaro

Thank you.