You Don't Need Containers to Run Django in Production with Eduardo Felipe Castegnaro
Published November 23, 2022
This video features Eduardo Felipe Castegnaro at DjangoCon US 2026 in Chicago, Illinois, USA.
Working on the same codebase for 15 years is not something that you plan on doing. It's something that happens organically. As the years go on and the business requirements become ever more complex, you'll need to keep up with the stack to be able to deliver the product your users expect.
This talk will cover what worked (and what didn't) while building and running a codebase in production for over 15 years. You'll find out what it takes to bring a project from Python 2.6 and Django 1.2 all the way to Python 3.14 and Django 5.2.
We’ll explore how following release cycles, understanding release notes and deprecation policies helps you write code that is low maintenance while flexible enough to change when the time comes.
There will be samples of how individual views in the project were updated to take advantage of new features in the framework, including dropping dependencies when third-party libraries eventually made their way into Django.
Sometimes there might be a need to create workarounds for breaking changes or even backport a patch, so we'll also go over some tips on when bending the rules is the right decision.
This talk was presented by Eduardo Felipe Castegnaro at DjangoCon US 2026 in Chicago, Illinois, USA
https://2026.djangocon.us/talks/keeping-pace-with-django-evolving-through-15-years-of-updates/
Automatically transcribed, so expect mistakes in names and technical terms.
Speaker 1: Good afternoon everyone. I'm Eduardo. I am the technology director for a company called OnSign. And 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. So 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, uh does anyone know what CentOS is? Old enough? Oh, there's a few ones. So I started working on customizing the installer for it.
Speaker 1: 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. And then a couple of years later, I started into Google Summer of Code. And I worked for a project called Review Board, which it which did software reviews before GitHub PR was a thing. And that's when really I started picking up Facebook Django and and getting to know all the features
Speaker 1: And then I graduated, I became a tech lead at the same company that I interned, and around 2011 , we decided to try three different products. And they were uh on all web development products and only one of those really worked and I still work on it and it's called OnSign. Here is the first commit for OnSign and I'm uh I am really really pissed that that it's actually not my name up there I was the first committer on one of those that did not work. So a couple of uh uh of Weeks later I actually did my first commit for on sign, which you can see here.
Speaker 1: And it is like Yeah, it's like seeing seeing a a version of the past, like uh something of a different era. Uh do you remember before time where Django did not have swappable user models? Oh those times were rough. So yeah. So this is basically all releases that we've been through Django Django release we've been through on online. We started here. So it's Django 1. 2. And we've been over 21 releases down here on 5. 2. So that is 15 years and a lot of versions, 21 versions.
Speaker 1: Well, because we are a business and not like an open source project, uh we have to balance our attention between uh changing our 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 So we started skipping updates. We didn't do the the point uh the point two, point point uh 2. 0, 2. 1, we only did 2. 2 and and so on. And this is uh uh uh um unfortunately Natalie already spoiled my part where we're gonna talk about the new release schedule, but hey.
Speaker 1: Uh so One thing that is very particular and that I keep hearing again and again and like five minutes ago Elizabeth just mentioned that we we do things that are messy and weird And like on sign is a CMS and people use it to to organize and display contents on screens all around the world. And in 2014, something that was really on demand was the ability to put a playlist inside of a playlist so they can show their content and keep it organized. This you know this maps really good with a recursive common table expression which Elizabeth called messy and it is messy
Speaker 1: but it also works really great. So One thing that doesn't really work is uh it doesn't really work with Django's ORM. It it's it is kind of uh 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 Uh 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 would
Speaker 1: be like 1% of the users that actually required so many uh raw queries in their database and that's not really what Django was supposed to be. And I do believe that because uh We we are not necessarily regular users. We have advanced needs. Just like once Postgres really starts going with graph, we'll probably explore explore migrating all our CTEs to graphs. And that will probably happen before Django actually supports it. So But the thing is, if you keep working at something like nonstop and the framework keeps improving non-stop, You get to reap the rewards. Like
Speaker 1: in 1. 3 we got template response, which was amazing. And in 1. 4 time zones, you have no idea how much we needed time zones And then we had swappable user models and we had migrations. We we had South before, I'm not sure. Hey, raise of hands, who remember South? Oh, Andrew. Andrew is my hero. Then 1. 8 we had raw SQL and Arrayfield, both something that we use. extensively in our code base and a Genzo field and uh an array aggregation and then subquery exists the the gene index we don't have to make it by hand book updates and filter on a raw sequel
Speaker 1: the the guy that wrote the the PR is my personal hero I pray to him every day this This eliminated so many annotating filters on our code base you would not believe. And then we could completely remove our write disk cache and use the native one And I am really looking forward to CSP and fetch modes. Those are the top things for me. And and this is the thing, which Every single time it evolved, we also get a better, uh we got a better code base. So the first time we needed an extra was in 2012. like one year after we started. And then we were able to replace most extras with Raw
Speaker 1: Sequen 2016 when it was introduced. We were able to replace some raw SQLs with subqueries and then some when we it was allowed in filter it was amazing. And the last time we actually had to add an extra to a query set in Django was 2022, four years ago. This is great. And the thing is, with the new release cycle. You really get to to enjoy and update much faster because right now We like I said, we tend to wait for LTS releases to actually go to the new version. And now we'll be able to pick and choose the best time to migrate. And Natalia mentioned today that that this new release cycle is going to make
Speaker 1: Easier for people to adopt new versions of Django. And I agreed and was like, yes, people like me. And so Okay, now that that I told you the backstory of everything, uh 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. Like that is the gist of it. If you know something, if you come out of this talk with one thing in mind, is just read the release notes. They are actually Quite detailed. There's a lot of information there and and I don't know if I'm kind of weird, but I I also think they are fun.
Speaker 1: There is sometimes little jokes in here and there and things like, oh, I I like that. And 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 when it comes the four structure, the four sections that is it that are in every single one of the release nodes, which is what's new. Backward incompatible changes, features that were deprecated, and features that were removed So I'm gonna talk a little bit about each one of them and how they affect our code base. So
Speaker 1: the first what's new it they are like the new toys and I'm gonna big bring something that was new actually in Twenty 2013, but it was new for us. When we started doing uh single sign-on for our platform, we needed a way to log users out of all sessions. By then we were already using uh Redis to hold our sessions. This is our actually code uh code from uh over ten years ago. And we use the signal when the user logged in. We recorded the session key of in a list of sessions. And then when the user logged out or requested to be logged out of every single session, we just iterated on the list and deleted the session.
Speaker 1: Messy, but worked. And then in Django 1 1. 7, under the minor section of what's new, the minor section is my favorite. Actually, miscellaneous is my favorite because that's So many good stuff there. So in the minor sections, there was this little text saying that, okay, abstract-based user, the get session out hash. Now you can invalidate all olders all sessions of a user at once. So here we were able to just delete all that messy code and just replace it with a simple method on our user that says, okay, the last logout, which is the single sign-on logout, it is now part
Speaker 1: of our out of our session hash and if someone logs the user out the session has the session hash changes and he is logged out of everything So now we go to the next session, which is the backwards incompatible changes, which is like okay. This 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. And the sad part where they say, oh, you know, your version of Postgres that you love so much, not supported anymore. Or maybe you really like The the Maria de B 10. 2. Nope, not gonna go.
Speaker 1: 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. And this usually takes a lot of planning on our side. We try to do to minimize the our downtime. So We've been live migrating a Postgres from 9. 5 up until Postgres 17, which is the late version that we are currently currently running. So this is the thing that also it not Django related, but it's related to the project, right? So this This is the sad part, but I understand. It's not a yeah, we don't want to be a burden on the Django community to support really old versions.
Speaker 1: So the next part is that features deprecated, this is this will break production when they are removed, just not right now. This is much more related to the Django's APIs themselves not like external packages or dependencies, but really Django. And and this is the thing. Django has a deprecation policy. Which is live, you can just go to the deprecation policy and it will say something like this, which means that something that was introduced on version 4. 2. They will you will was deprecated in version 4. 2. They will you will get it removed in 5. 1 warning. And 5. 0 it will still work with the warning and in
Speaker 1: five 5. 1 it will be completely completely removed. But here's the thing. The deprecation policy is still being adjusted for the new release cycle. So currently, if you go there, you will see that it mentions things that will be removed in Django 7. 1, which will never exist. This is this is a a mysterious version of Django. It's gonna be 28 Django 2028. So but the 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. Because if it was deprecated in a long-term support, then you have a lot of time. If it was deprecated in a minor version you have less time.
Speaker 1: 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 uh 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.
Speaker 1: Some can get a little bit messy, but but it's uh usually it's quite quite simple. Now comes the sad part when the features are actually removed. And you know, 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 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 uh when they are deprecated, you neck 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
Speaker 1: not we don't necessarily do everything right. Sometimes a few things slip by So this is now what we actually do for real. So this is the real PR that was done a couple of months, no, on April this year when we migrated to Django 5. 2 And it says everything that was deprecated and everything that was was cleaned up. And then one of the commits was actually About something that was removed in 5. 0, we should have, when we went to 4. 2, we should have updated it. Like I said, it was it would be less work for ourselves. But Somehow we didn't and then during this update when it's actually removed
Speaker 1: we went ahead and we changed this. And you know The thing is we do 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 uh Django up to date and usually that works really really well and I just want to tell you about The 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
Speaker 1: The query set order by on a JSON field that had a custom decoder. And as a consequence, uh this is the important part here. As a consequence, JSON filled with Raw SQL now returns 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. So this this one is like uh it was not present at all. During the 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 Mo 3. 2 was relatively
Speaker 1: light in terms of of deprecations. So it was an easy upgrade for us and everything seemed fine. Uh until we we departed to a staging and it broke in a few hours when actually one of those recursive CTE squares were hit. And then that's the thing. Sometimes we actually agree to have to agree to disagree. And and this is the thing that uh uh all the the keynote all the the talks here talk about developing Django as a framework and on the point of the 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
Speaker 1: and those that 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 almost for over four years and nothing broke up 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 we already discussed in the mailing list
Speaker 1: or in the track. And we had developed a Django Django steering is steering members, council members telling us that oh this is not something we are interested in in offering our users. That's fine with us. We just keep monkey patching it away. So this is what did we learn from this? Well, if you work 15 years in 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. to follow Django for that product long enough. And
Speaker 1: but if you do put in some time, you can bring and update your code base. And Django really we have views that are 15 years old and works perfectly right now. And in our world of technology, that that moves so fast and there are 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, you know 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.
Speaker 1: And I do I would say that you should stick to an LTS release to ease your maintenance burden, but actually With the new release cycle, uh I'm not sure if that's that works anymore. You just release 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 code base and how do we maintain it and to make sure that is it is read It is readable in the future when
Speaker 1: my mind doesn't work anymore and my memory of everything is it 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. Like uh like the talk was about your experience uh up the uh going with the updates of Django, but what about the other dependencies?
Speaker 1: Yes, uh 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 we have to vendor them. And we usually try to replace them, uh, but sometimes uh a dependency that we really like is kind of abandoned. And then we just fork the process the project on GitHub and we keep sending updates and use our own version. We don't try to make a release public, but the code is there and and it 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? Uh for instance, we often don't document bug fixes if they haven't been if it's nothing that's been broken recently. Um if it's something that's you know, 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 node. Unless we can anticipate somebody's probably relying on that beh you know the quote wrong behavior, then we'll slip in a release note somewhere. So there's 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.
Speaker 1: Yeah, the thing is uh 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 like, oh, this internal method is now deprecated, which shouldn't even be a thing. It's an internal method. But uh from the point of uh of a user the more the merrier. I I guess uh uh we are are not able to discern like the 3. 1 point one all the the side effects of that bug fix in particular. So uh I don't think that the miscellaneous a section can be quite big enough. The miscellaneous can always grow. There's a lot of miscellaneous there.
Speaker 2: Well um thank you uh from the organization. This is uh good for you.
Speaker 1: Thank you.
August 24 - 28, 2026
Chicago, Illinois, USA
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026