Keynote: Django 6: The Most Exciting Release Ever with Karen Tracey
Transcript
By Speaker 1, Speaker 2, Speaker 3, Speaker 4, Speaker 5, Speaker 6, Speaker 7. From DjangoCon US 2026. Published October 26, 2026.
Watch the video Markdown version 5,985 words · auto-generated · en
Transcript
Automatically transcribed, so expect mistakes in names and technical terms. Filler words are removed.
Speaker 1
Thank you for coming. Thank you for inviting me. Thank you for accepting my talk. I'm very excited today to talk about Django 6, which I have labeled the most exciting release ever, which you may respond to by saying, “How could that possibly be?” Django has been around for twenty-one years of releases. Could you really have the most exciting release coming up so recently? All I can say is I've been around for 20 of those 21 years, and my genuine reaction on reading the release notes for Django 6.0 was, “Wow, this is—there's a lot packed in here. There's a lot of really good things in here.” So I thought we could talk about that.
And some of the things that I find particularly exciting in the Django 6.0 and 6.1 releases. Depending on how much time we have at the end, maybe you're going to come at me and say, “Hey, no, there's more exciting releases in the past that really should have gotten more attention.” But we'll see how that goes. Just a little bit about me: I said I've been here for 20 years of Django. It was almost exactly 20 years ago now that I first started using Django for a hobby project. That was before the Django 1.0 release. I was bringing my own existing database to a project, and I had some issues. There was some weirdness around that database that didn't quite agree with the utility
Django had to inspect the database. So I almost immediately got into reporting issues and was invited to create a patch, and that worked out. So I started getting involved right after starting to use Django. I started getting involved in helping develop Django. A few years after Django 1.0 came out, I became a core developer, and I was involved in helping get subsequent releases out the door. So part of what I think is that, for people who have been here that long, maybe some of those earlier releases would have seemed more exciting. I don't know. But being behind the scenes and really deeply involved, maybe I didn't see it as that exciting. So you may have a different opinion, and I'm interested in hearing what other people think.
So we'll see how long I talk to see if we have a chance to talk about what other people think. What is it that I find so exciting about Django 6.0? This is specifically 6.0 that I'm talking about for most of the talk, because that was what was out when I proposed the talk. The picture I put here is AI-generated, highlighting four big, pretty flowers on a background of a lot of smaller flowers. I'm going to talk about four big things, but I did want to mention there are little gems throughout the release notes. You should read the full release notes, including the miscellaneous section, to see what all is in there that might appeal to you or your particular project.
Particularly address some particular pain point you have. There's always more than the big features. The four big features that I will be talking about are the Python Modern Email API, and these are in order of increasing level of my own excitement. So we'll talk a little bit about the Python Modern Email API, and then there's also the Content Security Policy, which I think Eduardo mentioned yesterday is being excited about coming. There's the Background Tasks Framework, which I've seen at least two talks here about pluggable back ends for the background task framework, so I know there's more excitement about that. And then there's template partials, which there's a talk later today about template partials.
So at least have some other people also excited about some of these features. I haven't seen anyone talk about the Modern Email API, so I'll start briefly with that one. That may be because it's not a really big change for users of email in Django. The email API provided by Django is largely unchanged. But Django itself, in providing email service to its application clients, is now using the cleaner and more Unicode-friendly email API from Python 3.6. There are some deprecations involved in this, so over time...
You may need to change your email code in Django if you have built off of some custom classes, for instance, that Django used to use. But with this change, you, as a user of Django's email API, would get back a Python email message class instance rather than a custom Django class instance. It did kind of the same thing. So you get access to that standard Python class and everything that it does, which may be a little more capable than it had been in the past. And what I find exciting, as I said when I gave this talk as a practice talk last week, is that I need to come up with more synonyms for exciting.
I like this feature because it's healthy. It indicates the health of Django, that it's moving along with Python and picking up the features that Python is adding. Whereas in the past, as an outsider now from Django Core, I would expect Django had to build a certain amount of glue and scaffolding code to adapt the API it wanted to provide for its Django code projects to a less capable Python API. And now, with this, that scaffolding and glue code can be slimmed down, with less to maintain in the future.
So that seems very healthy for the project, that that kind of thing is going on and getting included. So that's my first exciting feature of Django 6. Second is content security policy, which I'm not a huge fan of security. Well, I mean, I am in that I like the intent, but the annoyance of having to deal with all the things is, as an application developer, just get out of my way and let me do what needs to be done. So, content security policy: you could have a whole set of talks probably about the specifics of it. So I'm just going to cover it at a high level and briefly, and describe what's
been added to Django. It is a W3C standard. The aim is to prevent code injection so that you can write your web application and be sure that the browsers are getting just the code that you wrote, not the code that got injected by some bad actor. And the overall way in which it works is your application provides headers in responses that indicate what code and images and what content should be trusted by the browsers, and then the browsers implement following those rules. And, like the CSRF protection, that may mean that the same magic value needs to be provided in two different channels, like in the header and in the content, as a value of a nonce, for instance, and like CSRF protection.
What Django has, by supporting this, you have easy ways to make sure that those values are set correctly, and you can lock down your application so that it has less ability, hopefully less exposure to injected code. There was at least one project, Django CSP, that provided this as a third-party package, but it's very encouraging and excellent, I think, that Django has incorporated that into the base because that elevates the visibility to the application programmers. When you read the Django release notes, there's this. And when you read about configuring your application now, it's right there that you should be worrying about
setting up content security policy and deciding what your content security policy should be, how to implement it. So it elevates the visibility of dealing with this and it simplifies the implementation. You don't have another third-party package that you have to bring in and manage. So I think that's exciting that Django has included that. Third, we'll move on to background tasks. And we, as I said, I've heard at least two talks about background tasks: pluggable back ends for the background tasks. So probably everyone understands what background tasks are in a Django application. You have a web server, you get a web request. It asks you to do something that requires perhaps some extra work to be done that you really don't want to be doing on the request-processing thread because it may involve talking to another server
That may be slow, block your user request. So you'd really like to be able to say, okay, this is a package of work. I want to go and queue it up to get done later. Until this background task framework was added to Django, there was no standard way in Django to do that. There were third-party packages that provided background tasks in different ways. So you, as an application writer, particularly if you were writing an application or a package that could be incorporated into other people's projects, had no standard way of saying, I want to do this work. I want to do it later. An example of that is Wagtail. Wagtail has a number of things that it would like to do as a result of the user doing something in the admin.
That really shouldn't be done on the request processing thread, but it couldn't dictate a way in which to do that. So by default it would just do it on the request processing thread, until, I think, Wagtail 6.4 added support for using the Django Tasks package. And it's the Django Tasks package and that implementation that eventually got pulled into Django, and that is what the Django background task framework is now. That allows your code, in a reusable way, to define what these background tasks are, queue them up to be performed, and retrieve any results from them. So that's
It's a framework for how to set up this work. It isn't a framework for implementing a backend that actually does the work. And Django 6.0 itself doesn't really provide a production-ready backend. So there are two backends provided. One allows you to run the task immediately when you enqueue it; the other, I think, doesn't run it at all. So those can be used in development and testing, but for deployment you would need to find a backend that implements the background task in a way that works for your application. And there is a
Database backend that used to be part of the Django Tasks independent package, that has now been split out into its own little package that you could add to Django 6.0. And as I said, there are two talks earlier in this conference that talked about this. One was Django Absurd, and the other was implementing a Celery backend, which is probably the most common thing you've seen people use for backend tasks: doing it the Celery way. But an issue with Celery, to my mind, is it brings a lot of complexity and possibly a lot of other infrastructure you need. With Celery, you have to choose what your
Message broker is going to be, what your storage backend for your results is going to be. There's configuration; there's more infrastructure. And in a lot of cases, there are projects I've worked on where it's like, this is beyond what we need for the needs of this particular fairly simple application. So I think it's great that we now have a start at making it possible to standardize how this work is enqueued and how this work is then executed, and I'm hopeful that there will be more backends that either thrive as third-party packages or ultimately do get pulled into Django. I do think it would be really helpful if there was at least one production-ready backend in Django core to make it possible to have
Background tasks without jumping through many hoops. Okay. What am I doing? Okay. Then the last one I want to talk about is the one I'm most excited about: template partials. This is also another thing that was a third-party package that ultimately got pulled into Django. Template partials are named, reusable fragments of a template. The cool thing about that is that the fragment inside of a template can be rendered individually. As a render call, you can say, “I don't want to render this whole template; I just want to render this little piece of it.” And the image I have here is—imagine that's a whole template, and
the highlighted bits are defined to be template fragments. And with HTMX, which I haven't heard a lot about here at this conference, but I've heard about it a lot at previous conferences, so I'm hopeful most people know what I'm talking about, you can annotate your form so that instead of submitting it and requiring a full page reload, HTMX will submit it and then take the response back and replace a section of the page. So you might see it replace just the upper portion, the upper-right-side portion of the page, with the results of a form that you submitted. And this is a solution to a pain point that I encountered when I was using HTMX on a project. It was lovely to have the ability to
submit forms and have interaction on a page that updated a portion of the page very easily. From a user point of view, it was lovely, but from a developer point of view, every time I needed an HTMX response to just respond with a small portion of a page, I ended up having to take my template for that page and extract that little bit out into its own little files that it could be included. And that was not an ideal developer experience, and template partials address that. This is the one I'll talk a little bit more about: the details of what you see on the template side and what you see on the backend view side. So, for template partials, you get a new template tag, `partialdef`,
to define a partial, and I've named this one RSVP data. You can imagine that form on the previous slide was maybe, you know, signing up for an event, and you want to be able to gather the users' information, have them say they want to attend, and then respond with a message saying you've been signed up or something like that. So the name of this partialdef is RSVP data, and the `inline` says actually render it right here in the template where I've defined it. You can also render a named template partial somewhere else using a `partial` tag if you want to do that, which is probably not something you want to do with a form like this. There are uses for
template partials beyond the HTMX case that I'm particularly excited about and focused on. So it's a block template tag, `partialdef` and the name. It has a pairing `endpartialdef`. Optionally, you can specify the name if that clarifies things in your template. And then on the backend side, in your view, you can have a single view that is serving both the full page load of this page and maybe responding to those individual requests. So you may have code that has figured out everything that needs to be sent back in various cases, and at the point where you're going to render a response, you can check if the request has come in via HTMX. And here I'm using the Django
HTMX package to make that syntax a little easier. So if it's an HTMX request and you've figured out what to respond with in context—that's in the dot dot dot—you just want to re-render your template and specify, after the hash, the name of the partial that you want to render. So you can keep all your locality, all your template—interesting, what I noticed when I was doing this without template partials was that the most interesting things in a template were getting extracted out into these little files, and it was hard to follow what was in the template. So, yeah, I think it's very helpful to be able to have it stay in one place and be visible, and have the backend just be able to specify
“Render this part of the template.” And of course, if it is a full page reload, if it's not an HTMX request, then you can just render the whole template with hopefully a full context of things. So that's everything that I want to talk about in Django 6.0. And that was what existed at the point in time, I think, when I submitted this talk. But since then, we also have Django 6.1 coming out. So I did want to talk a little bit more about that because there's more exciting things that are coming in there. Okay, we're doing okay. There's three features I listed up there. I won't go into a lot of details. There's a mailers setting that lets you
Similar to a lot of other Django settings over the years that have gone from you having one of these things—you have one database, one storage backend, one cache—you now can configure multiple. You can say there's a default database and there's another database that you may use for some things. Same thing for storage. You might have the same situation with mailers if you have different mail backends that you would want to use in different situations. And I suppose I have time to mention this. As an aside, you may wonder, “Well, why would you ever need multiple mail accounts? I mean, why would you do that?” And what I found out recently was with a project that is not Django. It is
associated with the rescue I work with. If you have a form on your website that is open to the world, that anyone can submit to and supply an email address that ends up trying to email that address, that's a vector for attacking your ability to send email. What we had on our WordPress website for the rescue is a donation form. And what happened over the weekend was somebody decided to start testing out credit card numbers and see if they worked. And they did that using a bunch of bogus emails. And WordPress saw enough of these bogus emails get bounced when
the response was, “This card doesn't work,” that it decided, “Ah, you can't send an email anymore.” So we had to deal with that. So if you have those open kinds of things on a form, you may want to have two different email accounts: one that you don't care if it gets shut down, and one that you want to be able to reliably send email to email addresses that you have already verified are okay. So that's a situation where you may want to have two different mailers. And there are other cases. I think the example in the docs talks about marketing versus transactional emails. So there are other cases where you might want to do it. As a developer, I hadn't seen this particular need before.
The next 6.1 feature that I find exciting is database-level delete options to say whether the database should handle cascade delete or Django should handle cascade delete. So up until this time, if you had an object that had lots of things that were going to get cascade-deleted as a result of deleting it, Django would do a lot of work to do that, and it would collect all those things together. And if you ever tried this in admin with something that had a lot of related objects that were going to get deleted, you may have noticed that you don't get the confirmation page that says, “These are all the things that are going to get deleted,” because it takes so long to gather them that the web server times out. And we've had at least one project where we had to write custom code that
It's a client that gathers a lot of information over the course of a year, and then they reset for their clients, like, “Throw away everything from last year; we're gonna start over fresh.” So at the top level, they just want to delete the client. And the client has all this stuff that has been collected over the years, and it's going to take a long time to delete it all. So we have custom code that says, okay, you mark it deleted; you can't see it anymore in the front end. Overnight, we're going to start up a task that's going to go and figure out how to delete these things from the bottom up so that there's not a lot of work needing to be done by Django to do that. It would be great to get rid of that code. So I'd love to be able to use this feature and see if I can tell the database, “Just delete this client; you go figure out all the things to delete.” How quickly would that work?
I don't know how much work the database itself would have to do to do that, but I'd love to experiment with it. And then the third feature in Django 6.1 that excites me is something called model field fetch modes, which for some reason I have a hard time saying. And what this is, is when you have a queryset where you have said you want to defer loading some of the fields. And then later on, your code starts to go down a path and tries to access one of those fields you deferred. Django currently will say, “Okay, I'll go fetch that data for this instance.” What model field fetch modes
does is allow you to say, if I end up accessing one of those deferred fields, go ahead and fetch all of the fields for all the querysets. That's much more efficient than, if you're going to end up touching it for all of the items in a queryset, fetching them one by one. Or you might be going down a path where this is just one that you're going to need, so that's fine. Do that. Continue to do that. Or it may be that you never intended to access that deferred field, and it's a surprise to you that your code went down that path. So that may be an indication of an error, and what you'd like Django to do would be to raise an exception. So you can configure that behavior with model field fetch modes.
And finally, this isn't a feature in 6.1, but it's another exciting thing that's coming up that a couple of people mentioned in the last couple of days: Django is moving to an annual release cycle, an annual LTS release cycle starting in 2028. We've been on sort of an every-two-year release cycle for LTSs, with the .0, .1, .2. For myself, I work on a lot of established projects that are somewhat cautious, and they want to be on LTSs. So the effect of Django's current release cycle has been that these projects only get updated every other year.
That means it's somewhat of a bigger lift to do it because you're actually jumping through three releases as you go from one LTS to another. So it'd be a lower effort to do it every year for a smaller set of changes, and I would get to use these features a lot sooner than I can now. Because I can't actually use most of these features in most of my projects, because most of them are on 5.2. So they're not gonna move up until 6.2 is out. So that's a bummer. Then there's one other thing I wanted to talk about as exciting. If you are excited by any of these features, or not excited and thinking there's something else that I would like to get into Django.
Django is experimenting with a new way of getting community consensus on what is important to get into Django, and that is the Django New Features GitHub repo, which has a Kanban board view into it. And you can see this is just a screenshot. You're not supposed to be able to read anything; it's not necessary to read anything. It's been configured with the columns progressing from just an idea, a simple idea to see if people are interested, to an idea that's gathering a team and refining it, to someone's working on it, and to someone is, you know, they've got a working solution and they need review
This is going to go into Django. We need someone closer to the Django core team to shepherd it into Django 6. There are—this is a screenshot from a couple of days ago—38 things that are already done via this process. So I thought that was cool. If you're interested in contributing, if you have an idea for something that Django could add or fix or whatever, take a look at the Django New Features repo. And that is the last slide I had that had content, and I'm interested if anyone has questions or would like to challenge my assertion that six
is the most exciting release ever. We'd propose something else as being the most exciting release. So
Speaker 2
Who has questions for Karen? Let's see. There he goes. Okay, a question back here from Eric.
Speaker 3
Yeah, I'd just like to hear a little bit more about the tasks framework. I'm pretty excited about it. I think that's a huge thing that a lot of Django developers hit pretty early. And I'm just curious a little bit more about the process behind it and what the path is for actually getting that production backend into core. Is that just formalizing that database backend, or just a little more about what the next steps there are?
Speaker 1
I don't actually know why the Django Tasks database backend wasn't included. Someone may have an answer, someone who's closer to Django.
Speaker 2
Natalia has her hand up over here, so maybe this is the answer.
Speaker 4
Hello. I'm one of the Django maintainers. We didn't include the database backend because it's not quite production-ready. Okay. We discussed it with Jake. They are using it for some things in Wagtail, so we have a plan. The idea is to include it as soon as we can. Jake has had some personal developments, so we're leaving it behind. But the plan is to include it for sure in Django core. It just needs—right now it's an external package, so people can use it. The best thing that you could do is use it, report issues, or help contribute to the stability of the backend. But it's definitely something that we want to include in Django.
Speaker 1
Yeah, and even without it in Django, if you're excited by having this solution and using it, in researching and doing this talk, I found blog posts that talked about, “Here's a backend I wrote, and it's really simple and it uses this.” And there's the Django Absurd one that used Postgres workflow, something that I didn't know what that base was. But there's also the ability to write your own that works for your project, and that may be good enough. Or there was talk of the Celery one yesterday. I'm hoping there would be a third-party package that provides compatibility with Celery fairly soon too. So
Speaker 2
Okay, more questions. All right, I've got one. If you could wave a magic wand and take one of the new features out of the new features repo and implement it in Django immediately, which would it be? What new feature would you add into Django if you had the option? This would make Django even better than Django 6.
Speaker 1
I don't have any big need that I feel is unmet at this point.
Speaker 2
That's okay. I'm going over to Tim and the steering committee. Let's see what he's got to say. Is it committee or council? Is that right?
Speaker 5
Thank you, Karen. I've really enjoyed your talk. Since you highlighted the new features coming in, and also pointed out several of the new features came in as third-party packages, one of the things we're trying to do on the steering council is identify or make third-party packages a little bit more robust or accessible to people. You mentioned that you could only upgrade your applications from LTS to LTS. Do you have any ideas on how we can make the third-party ecosystem more robust or accessible to people, where it's all of the features in Django rather than just in Django? I hope that question makes sense.
Speaker 1
Kind of. I mean, there was—I'm blanking on the name—Jazzband, which was a way to sort of gather up supported packages and have a team that was supporting the packages, but that has been retired. You have a new one, don't you? Commons. Django Commons. I think those are excellent efforts. I think it would be good to have a collection of third-party packages that are not just single-maintainer, because over the years of supporting Django
applications, you pick up a third-party package, it looks like it's healthy, it provides what you want. And then two years down the road, you need to upgrade and the maintainer's gone, and you end up having to adopt it yourself if you want to continue to use it, or find something else. So I do think that approach of gathering together a group of people willing to put in the effort, having it be a group, and having it be associated with Django is a useful way to do that. And I would hope that continues in Django Commons now that Jazzband is gone.
Speaker 5
Great. Thank you.
Speaker 2
All right, Jeff, I'll go to you first, and then Paulo. Sorry.
Speaker 6
Amazing talk, by the way. In the spirit of “love it or leave it,” are there any features in Django that you have a particular love-it-or-leave-it feeling about, that you would want to see stay? We have so many batteries in Django, and there's talk of removing batteries, adding more batteries to it. Any thoughts on parts of the framework like that?
Speaker 1
That I would want to keep particularly, or
Speaker 6
Either way.
Speaker 1
I know that's been a perennial redo-admin—that hasn't happened. I think in its current form, it's great still. So admin and the ORM, of course, you'd want to keep. Personally, for me, I can do without async support. It just doesn't excite me. You'll notice I didn't mention anything about async. It's not a need that I've had. That's about all I can think of. I mean, there's so much in Django: forms and server-side rendering and everything that lets you do
with HTMX and some JavaScript on the front. Nice applications nowadays. Forms in particular was something that I really missed when we were all on a heavy front-end framework, and matching—you need to redo your validation in two different places. I didn't like that at all. So the forms, with the modern abilities of updating the page, I think are also very valuable and worth keeping.
Speaker 7
It's great to see that after twenty years you're excited about our release of Django. I can say that I saw some of these features being developed during sprints, and people were excited to finally finalize this. This pull request was last year at the Django on-demand sprints, and people were getting excited to work on that. And Cartoon and Lily presented the new feature repository, which is great. What do you want to suggest people work on during the sprints that we have here at DjangoCon
US, or what feature do you want to work on if you are participating during the sprint?
Speaker 1
I want people to work on the things they want to get done. And I would echo something I heard yesterday: look to see what's out there in a pull request already and see if anything there that needs review appeals to you, and maybe help move it along, versus starting on something new. That would be what I've usually done at sprints when I've been able to attend: find a ticket. One time I was like, “I'm gonna find the oldest ticket in Trac. Tackle that.” But I think the way to get sustainable involvement is to work on what is important to yourself.
Otherwise, if you're just working on stuff that is important to other people, but you don't see the need, you're probably going to lose interest. So I would encourage people to find what they would like to see added or fixed, and focus on that. Maybe focus on seeing if there's existing stuff that addresses some of their pain points that could be reviewed and moved along.
Speaker 5
Awesome. Any more questions? All right, let's give Karen one more round of applause, please.
Speaker 1
Thank you.