Latest / Talk Python To Me / #428: Django Trends in 2023
Transcript
- 0:00Have you heard of Django? It's this little web framework that, well, kicked off much of Python's
- 0:05significance in the web space back in 2005. And that makes Django officially an adult. That's
- 0:11right, Django is now 18, and Django continues to lead the way on how communities should be done for
- 0:16individual projects such as web frameworks. We have Carlton Gibson and Wilvison back on the show
- 0:22this episode to discuss a bit of Django history, Django trends in 2023, a little bit of HTMX and
- 0:28Django, and lots more. This is Talk Python To Me, episode 428, recorded July 26th, 2023.
- 0:35Welcome to Talk Python To Me, a weekly podcast on Python. This is your host, Michael Kennedy. Follow
- 0:54me on Mastodon, where I'm @mkennedy and follow the podcast using @talkpython, both on
- 0:59fosstodon.org. Be careful with impersonating accounts on other instances. There are many.
- 1:04Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
- 1:09We've started streaming most of our episodes live on YouTube. Subscribe to our YouTube channel over
- 1:15at talkpython.fm to get notified about upcoming shows and be part of that episode.
- 1:21This episode is brought to you by Sentry and us over at Talk Python Training. Please check out what
- 1:27we're both offering during our segments. It really helps support the show.
- 1:31Will Carlton, welcome to Talk Python To Me. It's awesome to have you both back on the show.
- 1:37Thank you for having us on again, Michael.
- 1:38Yes, thank you. It's always fun.
- 1:39It's always fun to have other podcasters on the show. We'll talk a bit about your podcast
- 1:44in a moment. Maybe just do a quick introduction. I know people probably know you from your show,
- 1:48Django Chat. They know you from being on Talk Python previously, but for those who don't. Will,
- 1:53we'll go first.
- 1:54Sure. So, William Vincent, I have three books on Django, most notably Django for Beginners.
- 1:59I run a site, learndjango.com. I just got off three years being on the board of Django. So,
- 2:04Django is run by a nonprofit. I run a weekly newsletter on Django, Django News. Too many things.
- 2:10So, yeah, most of my time is spent doing some consulting and a lot of teaching and learning
- 2:14about Django. So, I'm very happy to be at that stage.
- 2:16It's a good combination, right?
- 2:17If you can make it work, it is. Yeah, if you need that sort of cycle of,
- 2:19you know, I need to learn too and be interested.
- 2:21Yes.
- 2:22I like learning and teaching.
- 2:23One of the challenges that I think people can fall into on the traps is if you just teach,
- 2:29it's hard to have that. It looks like a good idea, but let me tell you, it's a bad idea.
- 2:34And here's the three reasons. And here are the tears that I've shed because I tried this way.
- 2:39You need a little hands-on. Like for me, it's running all the infrastructure and APIs and mobile
- 2:44app stuff at Talk Python, which is plenty to get the tears. I've pulled out plenty of hair, but you know,
- 2:49like I think consulting plus teaching is a really common mix for that. You like it?
- 2:54Yeah, I do. I mean, so I've been working on, so I have this site, learnjango.com that I'm trying to
- 2:58consolidate everything onto that site. And so that's been an effort I've been working on in earnest the
- 3:03last couple of months. And so it's actually been really fun to just be an engineer for a change.
- 3:07And I kind of wish I could find a me to help me when I get stuck, but there is no being,
- 3:11as Carlton will share something, you know, being stuck is part of the game, but it's, it's uniquely
- 3:16satisfying and frustrating to code because everything is solvable. But I, you know, still,
- 3:22I find things that stopped me for a couple of days and I'm just like, it brings me back to like the
- 3:26first, you know, couple of months of coding and like the terror of like, I'm not smart enough. I can't do
- 3:31this, but I know that I'll get it done and I do get it done. So you get the yin and yang, but it's
- 3:36uniquely satisfying to do the commit and it's done, right? Whereas even, even a podcast,
- 3:41it's in the bank, but it's not quite the same binary feeling of accomplishment.
- 3:45That's true. The getting stuck is frustrating, but also it means you're about to level up,
- 3:50right? You're going to figure out something. Yeah.
- 3:52I try to be excited about it because I know if I'm stuck, then lots of other people are gonna be stuck
- 3:56or a lot of times I'm stuck on one little thing. And it's really, cause there's some other thing I,
- 4:00some fundamental that I didn't know as well as I thought I did. So we can talk about that,
- 4:04but I have, I have thoughts on all of that. So yeah, it's a nice, it's a nice mix to do.
- 4:08And more importantly, now I have friends and peers who, when I get stuck, I can ask them. So
- 4:13Carlton, of course, is one of them, you know, Django, former Django fellow, a couple others.
- 4:18It's important to, you know, we can talk about this, but when you're learning, learning how to ask a
- 4:22good question on Stack Overflow or Django has its own forum, which is a great resource forum
- 4:26that Django project.com, you know, but the next stage is like, I did a walk, I slept on it,
- 4:31like knowing when to ping a friend, cause you don't want to ping a friend all the time,
- 4:34but sometimes it's like, okay, like this is, I'm truly stuck. There's no point like wasting a week
- 4:39or two on this. Yeah, for sure. That's a really nice stage to get to. And it's also helpful to help
- 4:43other people too, cause you're thinking about something and someone gives you something they're
- 4:46stuck on. You're like, Oh, boom, that's that. And then you're like, Hey, I'm working on, you know,
- 4:50something that's stuck. So anyways, having a community is really, really levels you up too.
- 4:54And also people who can relate to good and bad things about code. Django is very stable,
- 4:58but has a host of new features, many of which I haven't actually used. Carlton can talk about them.
- 5:03So it's important to have community, right? Not just be in your own room with your computer fighting
- 5:08with it. Yeah. Yeah. Any trouble or good or bad thing you've had many, many other people have had,
- 5:13you just have to find them. Unlike the movie stereotypes, it's, it's way more social,
- 5:18this coding thing. It is before. Yeah. But before I let Carlton introduce himself,
- 5:22just a quick comment from the audience to make you feel good a bit from Bishon, who says the first
- 5:28book I read on Django was William's book. So thank you. Thank you. I appreciate that. Yeah. I just,
- 5:32one last point and then I want Carlton to talk, but I wrote three books, Django for Beginners,
- 5:36APIs, Professionals that first came out in 2018 and 19. And then I've updated all three of them every
- 5:42year since then. So on the one hand, it's been four years. I haven't had a new book,
- 5:46but it's also, I've written what? Or you've had 12 new books.
- 5:5012 new books. Yeah. I mean, I really have. I really have. It's, it doesn't feel quite as
- 5:55satisfying, but I know that I have a built-in audience and I've, so it's a weird dynamic to
- 5:59be in a situation where it's sustainable to maintain and update your stuff. I mean, I'm sure you can relate.
- 6:03You have all these different courses, right? That's the thing that falls off. You do the effort,
- 6:06you get the course out and then it goes out of date or it could be made better, but-
- 6:10Or Pydantic 2 comes out.
- 6:11Django every eight months comes out. Yeah. So it's, yeah,
- 6:15I try to think of the positive of it. It is, I feel like the book is so much better,
- 6:19but a lay person or family members or friends are like, when's the new book coming out? It's like,
- 6:23I just, I just did it. Like, yeah.
- 6:25Yeah, indeed. Carlton.
- 6:27Who are you, Carlton?
- 6:27Welcome. Who are you?
- 6:28Who am I? Well, my name's Carlton. I do a podcast with Will. So basically,
- 6:33I've just stepped down as a Django fellow. So I've spent the last five years being a Django fellow,
- 6:37which means I was contracted by the Django Software Foundation to help maintain Django itself. And they
- 6:42have a couple of fellows and I was one of them for that period. And I've stepped down in order to go
- 6:46back to building things with Django rather than working kind of just on Django. It's, so it's a kind of,
- 6:51you know, after five years, that's, that was a good time period. And it's time for me to go back to building
- 6:56things with Django. I've been using Django forever and I've, I'm a maintainer on a lot of projects in the
- 7:01ecosystem. So I've worked on Django as framework, Django Filter, Django Crispy Form, Django Compressor,
- 7:06Django AppCon. I've maintained the channels package. You know, I do quite a lot in that.
- 7:10So your code runs on many, many servers, you should say.
- 7:13More than like, I like to think about like, so one thing when I was a fellow, we were always, people always
- 7:19give us a bit of grief about how conservative Django is. It's very stable and very, you know, we're very cautious
- 7:25about making backwards incompatible changes. We try not to do that. We've got a solid deprecation policy,
- 7:30got the long-term support policies. And then at DjangoCon last year, somebody read out the numbers,
- 7:36the download numbers. It's not, you know, it's not necessarily the most downloaded package,
- 7:40but it's millions, millions of downloads, millions of projects that are using it.
- 7:44And you really can't break it. That's always really like humbling and really kind of,
- 7:49yeah, actually all the work we put into making sure that the product is stable is, that's good work.
- 7:55That's important work.
- 7:56Yeah. Threads is using it, Carlton. You're helping out Mark Zuckerberg.
- 7:59Yeah, yeah. Well, I'll be using a fork of it. We can get into that, but yeah.
- 8:03I was looking at a comment on the forum. I got a little heart from somebody asked on the Django forum,
- 8:08does Django scale or can I run it on lots of systems? And I'm like, well, you do know that Instagram was built on it.
- 8:14You know, they're still using that core request response cycle.
- 8:17And, you know, my comment was, you're not going to serve more traffic than Instagram.
- 8:20So yes, Threads is built on that core request response, but it's still essentially Django.
- 8:26Maybe not everyone is up on what Threads is. No, not a parallels programming thing, but a Twitter clone from Meta and Facebook, right?
- 8:34Apparently so, yes.
- 8:36We have an interview, maybe we can put in the show notes with Carl Mayer, who was original core Django developer who then went to Instagram.
- 8:42So he spoke for an hour about, so initially it was just, it was pure Django.
- 8:47And then as they scaled, they did things like they ripped out the ORM and they changed this and that, but there is still a core of it, the request response cycle that's in there.
- 8:55That's another interesting thing is Django, when you get to massive, massive size, a lot of companies, you know, they have thousands of engineers, right?
- 9:01We have, we Django has just the community. So as soon as you hop off the guardrails, then you're kind of on your own.
- 9:08And that's sort of separate debate on whether it's worth or not, but you can, you can get quite large and it's interesting.
- 9:13By contrast, like I believe Shopify is still on rails, I believe, or seem to have gone much longer.
- 9:19Carlton, yeah, you have something to add?
- 9:20Well, I don't think it's really, I mean, I know Instagram moved away from the ORM, but that was quite a long time ago.
- 9:26If you look at octopus and kraken, they're still basically using something that's basically vanilla Django to do, you know, massive projects.
- 9:33And so, you know, what it was back in, you know, 1.6, 1.7, 1.8, when Instagram were needing to pull away from what Django is, is a lot different from what Django is at 2.2, 3, 3, 4, now 4.2.
- 9:45Going to be 5, yeah.
- 9:47I wonder if they regret that. I wonder, not necessarily, maybe it was the right choice at the time, but do they kind of wish, like wish they had access.
- 9:56If nothing else, to fork version 5 instead of version 1.6.
- 9:59I wish they'd, I wish there'd been a bit more pushback on Django from thinking about, because what, what was it that caused them to change?
- 10:07I think the move from it being able to root string names, strings as view names, like, and having to import the view itself.
- 10:14And I think at that point, like, for Instagram to rewrite the whole stack, it was, it was too much.
- 10:19And in the end, they kind of forked, but it would have been great if we could have kept them on board.
- 10:23I think, yeah, for Instagram, they can, they can, it's, they got enough engineering chops, but it would have been much nicer for Django if we could have kept them on board, I think.
- 10:31Well, maybe like a quick positive shout out for the whole meta as a larger organization.
- 10:35They seem to be doing a lot for Python these days, you know.
- 10:38For Python, yes.
- 10:39They're really working a lot on, you know, Sam Gross's initiative on NoGill and the Faster Python and Cinder.
- 10:45And, you know, all that probably does come out of some of the foundational stuff for Instagram and running Django there.
- 10:51Yeah, and I think Carlton is still involved in very much in pushing Python forwards and, you know, what they're trying to do.
- 10:57So, you know, all QDots do them.
- 10:59It's, it's very easy to dog on the big corporation so they don't pay enough of that.
- 11:02But it's important to recognize when they do contribute that, yes, actually, that's a good thing.
- 11:07Yeah, there's plenty that need dogging on, like a lot.
- 11:09Most.
- 11:10We still have support for Oracle in Django, for example.
- 11:13Interesting.
- 11:14But Carlton, deployment, there's something else you're working on.
- 11:17Well, yes.
- 11:18I mean, so I've been, so one thing I wanted to quit or step down as fellow and get to work on is my button tool, which is my simple deployment tool.
- 11:26So it's, it's quite vanilla.
- 11:28It's old school.
- 11:29It uses virtual private server.
- 11:31It uses Ansible.
- 11:32It's all on AWS.
- 11:33And then I'm building UI and tooling on front of that.
- 11:36Slightly delayed because I've had personal issues that have taken me up.
- 11:41You know, my plan was sit down in April, get on with it.
- 11:43My son's been ill for a while.
- 11:45So that's, that's just on the back burner.
- 11:48The priority with all of these things is look after yourself.
- 11:50And in the situation we've been, I haven't had time to work on it particularly, but that will be the autumn now.
- 11:55And that's, that's kind of, yeah, I've been talking about it for a while.
- 11:58Time to actually ship it and have some capacity to ship it.
- 12:01But can we, can we do, can we give it a, maybe it's different angle of pitch, which is that, so it's built on.
- 12:06So deployment is trick.
- 12:07We can talk about this, you know, going from local to production is hard.
- 12:10And when, who do you use these days, right?
- 12:12Like there's AWS, there's Azure, there's kind of Google.
- 12:16There still is Heroku.
- 12:17There's new entrants like Fly and some other ones.
- 12:20But what do you really need?
- 12:21Like if you're with Django, you want someone who knows Django, who just like puts a layer on top of someone that's not going away like AWS.
- 12:29And essentially, as I understand it, Button is a Django fellow saying, here's, you have a Django app, you want to put it online.
- 12:36Let me solve all the hard things, do all the hard work for you.
- 12:40And it's a beautiful UI on something that's not going to change.
- 12:43Yeah, here we go.
- 12:44To have it.
- 12:45Because all the, it's interesting.
- 12:46I updated my books.
- 12:47I updated away from Heroku to Fly for the new update because Heroku eliminated their free tier.
- 12:53And I personally have really liked what Fly.io is doing, but it's hard to scale these companies.
- 12:59Like it's not, it's non-trivial to build what they have.
- 13:03And yet if you're AWS, right, all you're going to do is add, add, add, add features when big enterprise clients want things.
- 13:08And so at some point it becomes unusable for a solo person or a small startup.
- 13:12So I'm a fan of what Carlton's doing.
- 13:14Yeah, you want something scary.
- 13:16Just go to the AWS console dashboard.
- 13:18Yeah, exactly.
- 13:20You're like, well, where do I start?
- 13:21What should I use?
- 13:22There should be enough of a thing.
- 13:23I have a Python web app or I have a JavaScript, whatever JavaScript people do, like a, you know, a Rails app.
- 13:28Like I just want to get it up and have it not break.
- 13:30But this came, so this, the idea for Button came out of exactly those, those kind of thoughts was every week on Django chat, we'd have someone come on and deployment would always come up.
- 13:39And it would be like some elaborate story about what they're doing.
- 13:42And it's like, well, actually, if you keep it simple and keep it neat, first of all, here's how I deploy and here's how I get my clients to deploy.
- 13:49And this is how I deploy many projects over many years.
- 13:52And it's continually evolving.
- 13:53And then on the other hand, when you go to the AWS console, though, it's like this, ah, too much.
- 13:59You don't need 58 services and every configuration option under the button, under the sun.
- 14:07But it's nice to be able to break out of that, you know, if you do need to scale or you do need to do it.
- 14:12So anyway, this is my, you know, project.
- 14:14If it wasn't for life circumstances, I'd be slightly further along, but it's going to be the fall now.
- 14:19It's going to be, you know, the shit's coming on nicely.
- 14:21And the idea is a simple, a simple approach and with a nice UI on top of it that you can use.
- 14:27Well, you definitely have our wishes for your son to get well soon.
- 14:30So that's rough.
- 14:32Yeah, that's rough when your kid is sick.
- 14:34It's been a, yeah, it's been a full on year.
- 14:36It's been ill over a year now and it's just ongoing.
- 14:39And so, you know, that was another part of why I stepped down as fellow.
- 14:42I needed to take a bit of time just for the family.
- 14:44Absolutely.
- 14:45I think back to the button for a second, btn.dev, by the way.
- 14:49You can sign up for the mailing list or the alpha is available too.
- 14:52Nice.
- 14:52I'm constantly trying to push Carlton's stuff because he always downplays everything he's doing.
- 14:56I'm like, come on, man.
- 14:57Yeah, but I've got that natural developer shyness.
- 14:59I have to wait.
- 15:00I have to polish it and wait till it's perfect.
- 15:02And he's British.
- 15:02Yeah, and I'm British.
- 15:04So I'm nice and reserved.
- 15:06And anyway, Mike, were you going to make a question?
- 15:08It's exciting.
- 15:09And we were just talking about it.
- 15:11We were just hyping people up about it.
- 15:13How it's cool to have these huge deployments running tons of traffic, doing all sorts of
- 15:18amazing things with like, yeah, we scaled our servers.
- 15:21So we went from 500 to 300 with this trick.
- 15:24Yes, that's a cool thing that pushes the envelope that makes a lot of stuff possible with frameworks
- 15:28like Django and language like Python.
- 15:31But on the other hand, most of us are not Instagram.
- 15:35You're not Microsoft.
- 15:36You're not Google.
- 15:37You're not all these.
- 15:38And having or let's say you're not Netflix.
- 15:41I actually think that like what AWS console looks like has a lot to do with how Netflix
- 15:46works, probably given how early adopters they were.
- 15:49But I just think it's worth emphasizing.
- 15:51Push button.
- 15:52Get it running on a simple server.
- 15:54Make it secure.
- 15:55Keep it up.
- 15:56You know, zero downtime deploy type stuff.
- 15:58CI/CD, a push show brand.
- 16:00All those types of things.
- 16:01That's more than enough for most people, not just on your hobby projects, but on company
- 16:06business.
- 16:06Does your website get a thousand visitors a day?
- 16:09It doesn't need five servers with failover and Kubernetes clusters and sharded databases.
- 16:14And like it just doesn't.
- 16:15Right.
- 16:16And so having that option, something like button, it's pretty cool, I think.
- 16:19Yeah, that's exactly it.
- 16:20Like as you speak there, you're just singing to the choir for me.
- 16:22It's like, you know, you can get a small box, get a slightly bigger box if you need to.
- 16:28Get a slightly bigger box than that.
- 16:29You can go get quite, you can get an awful lot of box for not very much money.
- 16:32And then maybe two boxes.
- 16:34Yeah, yeah, yeah, exactly.
- 16:35But this, the kind of architecture I go for, you can scale to a very big site.
- 16:41And I know in recent years, Stack Overflow moved to a, you know, much more modern and
- 16:45fancy thing.
- 16:45But for a long, long, long, long time, they were running on the same kind of big database,
- 16:49couple of front end web servers, a load balancer, and nothing more than that.
- 16:53And you're not going to serve more traffic than Stack Overflow ever.
- 16:56Like nobody, not nobody, but basically nobody's going to serve.
- 16:59More traffic than that.
- 17:00So that's where I'm coming from.
- 17:01And it's not for everybody.
- 17:03And there's lots of people who've got opinions, but it's for people who haven't got an opinion.
- 17:06It's like, if you don't know, if you don't know how to deploy and you don't really have,
- 17:10if you're not already in the game, then well, this is how I do it.
- 17:14And you can choose to do it the same way.
- 17:15Sure.
- 17:16I'm really excited about it.
- 17:17And I have been talking about it for a long time and not having the capacity to work on it.
- 17:21And now I, bar family situation, I have that capacity.
- 17:24And so I'm looking forward to getting it out.
- 17:28This portion of Talk Python To Me is brought to you by Sentry.
- 17:31You know that Sentry captures the errors that would otherwise go unnoticed.
- 17:35Of course, they have incredible support for basically any Python framework.
- 17:39They have direct integrations with Flask, Django, FastAPI, and even things like AWS Lambda and Celery.
- 17:47But did you know they also have native integrations with mobile app frameworks?
- 17:51Whether you're building an Android or iOS app or both, you can gain complete visibility into your application's correctness,
- 17:59both on the mobile side and server side.
- 18:01We just completely rewrote Talk Python's mobile apps for taking our courses.
- 18:06And we massively benefited from having Sentry integration right from the start.
- 18:11We used Flutter for our native mobile framework.
- 18:13And with Sentry, it was literally just two lines of code to start capturing errors as soon as they happen.
- 18:20Of course, we don't love errors, but we do love making our users happy.
- 18:23Solving problems as soon as possible with Sentry on the mobile Flutter code
- 18:28and the Python server side code together made understanding error reports a breeze.
- 18:33So whether you're building Python server side apps or mobile apps or both,
- 18:38give Sentry a try to get a complete view of your app's correctness.
- 18:43Thank you to Sentry for sponsoring the show and helping us ship more reliable mobile apps to all of you.
- 18:48Well, I think it's more broadly, one of the things we're going to talk about is HTMX.
- 18:55And I think there is these more iterative tools.
- 18:58You don't need to jump to React if you just want a little thing.
- 19:01You don't need to go Kubernetes.
- 19:03I heard back in that was done.
- 19:04It was just all APIs now.
- 19:06Come on.
- 19:06It's all front-end.
- 19:07I put a toot up the other day that they convinced me otherwise meme.
- 19:12Django is a front-end framework.
- 19:14I'm busy writing an application.
- 19:16I'm using HTMX.
- 19:17I'm using Alpine.
- 19:18I'm using Tailwind.
- 19:19I'm doing it all in Django.
- 19:20I'm doing it all in Django templates.
- 19:23And it's like, you know, I'm hardly doing any of the exciting back-end stuff that we love Django for.
- 19:28It's all front-end.
- 19:29And it's just vanilla Django.
- 19:31It is.
- 19:32That's the thing that people who are learning, they're a full-stack developer and they're like,
- 19:35APIs, I got to do it all.
- 19:37And I mean, you must have this, Michael, with people.
- 19:39You're students.
- 19:40But I have this a lot of times.
- 19:41People who are new say, oh, I want this and that functionality.
- 19:44And I'm often like, don't go to APIs unless you need to.
- 19:47Because if you're a professional Django developer on a team of more than 10 people, yeah, you're
- 19:52going to write APIs because there will be front-end people who just do front-end.
- 19:56But when it's just you.
- 19:57And even if there's not front-end, there might be a mobile app.
- 20:00That's our primary case of APIs.
- 20:01Or you might have a public API for users or other companies to work with.
- 20:06It doesn't have to be that you're not doing server-side.
- 20:08But for a solo person or a small thing, don't just leap to it because it adds so much.
- 20:14complexity.
- 20:14Do you use Tornado or use an older Python thing?
- 20:18Pyramid, okay.
- 20:19I've considered switching to something like FastAPI or something like that.
- 20:23But then I look and I'm like, you know, it's like a real thin layer over just what would
- 20:27be the same anyway.
- 20:28And scalability is totally good.
- 20:31I mean, it works.
- 20:32It works, too.
- 20:33It'll run for months without me touching it.
- 20:34The chances the website go down and it's not my fault because I deployed something is almost
- 20:40zero.
- 20:40Like really, really, really close to zero.
- 20:42Either that or something's gone wrong in the data center.
- 20:44But like the website itself.
- 20:46And so, yeah, I chose that eight years ago and I'm still cruising with it.
- 20:50It's great.
- 20:50I had a client ask me about HA.
- 20:53HA, sorry.
- 20:53High availability.
- 20:54One time they were like, oh, don't we need multiple servers and multiple this or another?
- 20:58I'm like, well, how many nines do we need?
- 21:00I don't know.
- 21:00I can't remember the exact number now off the top of my head.
- 21:02But you're already at three nines, even just deploying on the kind of worst setup in the
- 21:07world.
- 21:07Because the number of the amount of downtime you'll have will be sub few minutes because
- 21:12and it will be exactly that.
- 21:13You deployed something wrong and then you revert it.
- 21:15Yeah, exactly.
- 21:16Like, oh, my gosh, quick.
- 21:17But we have I think people necessarily don't fully appreciate how much really high end technology
- 21:24for so little money we have accessible to us with these cloud providers.
- 21:27We have the best data centers in the world for ten dollars.
- 21:32Right.
- 21:32You know what I mean?
- 21:33It's not like, well, these people like you have the same thing that Netflix is using.
- 21:37And for a while, they're doing a third of the traffic of the Internet.
- 21:40Yes.
- 21:41Yeah, exactly.
- 21:42So three nines gives you nine hours off a year and you won't even have nine hours off a year.
- 21:47Like, yeah, that's highly unlikely.
- 21:49Yeah.
- 21:49You know, something goes down and you don't fix it.
- 21:51But like it's literally if you deploy, you fix it quickly.
- 21:55But you get that kind of uptime without having to have multiple availability zones and
- 22:00all the failover and all the things that, you know, they like to sell.
- 22:03Yeah.
- 22:04And yet getting to that point for people who are new, just the act of local versus production
- 22:08database stops people like every single person.
- 22:11Right.
- 22:11They build the site like it's a blog and then they deploy it and they're like, where's my
- 22:15blog?
- 22:15And it's like, oh, that database is different than this database.
- 22:18Like, you know, after a while, I get used to the idea.
- 22:20But it's like the code is there.
- 22:22Why isn't the data there?
- 22:23Right.
- 22:23And then so it's just this scale of up to how many nines do you need.
- 22:27But most people are focused on just put something up online and add continuous integration.
- 22:31Like, I mean, really, what are the basics?
- 22:33But they're not basic when you're doing it the first couple of times.
- 22:36No, they're not basic.
- 22:37They're not basic at all.
- 22:38So having something that kind of automates that.
- 22:40I think another thing is, you know, you have different team members or if you are an individual
- 22:44developer, maybe getting something up on the web.
- 22:47I know people I've spoken to about how daunting it is going from zero web apps published to
- 22:53one is a major challenge.
- 22:55Right.
- 22:55Like, I don't know Linux.
- 22:56I don't know the terminal.
- 22:58I don't do SSH.
- 22:59I don't understand the security.
- 23:01I don't understand the best practices.
- 23:03Like, I just can't, you know.
- 23:05Well, and that's something I emphasize in my books is getting something as fast as possible.
- 23:10It was a little bit smoother with Heroku than Fly, but Fly is still pretty.
- 23:13Like, I take some shortcuts, but I say they're shortcuts.
- 23:15You know, this isn't the most secure thing ever.
- 23:17But just getting something up that first time because it doesn't have to be crazy complicated.
- 23:22And I think the sooner you're dealing with a real live website, the better for many reasons.
- 23:26But yeah, that first one.
- 23:28You know, you've spent all this time building your application.
- 23:30You're finally ready to put it online.
- 23:32And then it's like, oh, learn about servers and learn about firewalls and learn about
- 23:37rewrite rules and learn about permissions and groups and users and
- 23:42Caching.
- 23:43Yeah.
- 23:44Well, I just say Django has a deployment checklist to help with this.
- 23:47But I still think, and others may agree with me in the community, that the local to production
- 23:51gap is a big one that Django could do things to address.
- 23:54For example, like everything defaults to local setup.
- 23:58The deployment checklist, yes, a great resource.
- 24:00I spend a lot of time in my books covering this, if you want, you know, handholding.
- 24:03Oh, and it's not just a checklist on the, like on the web that you look at.
- 24:07You can run manage.py, you know, space check dash dash.
- 24:10Yeah, it's a management command.
- 24:11And there's a whole, I guess would be the, I think, 12 or something now, sort of the, like,
- 24:16really don't launch it without this.
- 24:17These aren't even optimizations.
- 24:18This is like, just don't leak secrets everywhere.
- 24:21Yeah.
- 24:21But still for Django, I think for a lot of places, there's a tension, right?
- 24:24Between how friendly you are to beginners versus advanced users.
- 24:27And I think Django overall has done a very good job of still being friendly to beginners,
- 24:31but every, most technologies over time, you know, move towards where the hardcore users
- 24:37are because that's who's kind of doing this stuff.
- 24:39So that's a tension Django feels, Python, others.
- 24:42You know, how do you still keep it beginner friendly, but the people who are in charge want
- 24:46different things often?
- 24:48That's a real tension in programming and frameworks and all sorts of things.
- 24:51And I also think that that's why Python is so popular, honestly, right?
- 24:54You can do C++, you can do Rust.
- 24:56Like, these are really great for advanced people.
- 24:58You can do, you know, BB6 or super simple old school things that are great, easy for beginners.
- 25:04But like, Python is easy for beginners, but you can kind of bring in some more advanced stuff.
- 25:09You can bring in async.
- 25:10You can bring in generators.
- 25:12You can bring in ORMs, but you don't have to, where a lot of languages are like, guess
- 25:16what?
- 25:16We're going to start with a void voice, void star star.
- 25:19We're going to go from there, you know?
- 25:21Well, the old saying was second best for everything.
- 25:23And I think that's not, you know, I think it's first best a number of places now too.
- 25:27I agree.
- 25:28I think people say that, but I think honestly, it's really, if it's not the first best,
- 25:33it is on par with the other first best, right?
- 25:35It is a front running contender for a thing where I would say it probably is, you know,
- 25:40the undisputed king is in data science and machine learning.
- 25:43Yeah, it's all the libraries.
- 25:44There's not a competitor out there that is near the level of depth in the ecosystem.
- 25:49Well, because there's R and R doesn't have open source in the community that Python does.
- 25:54Yeah.
- 25:54That seems to be, I mean, most like here in Boston, a lot of friends are scientists and
- 25:58it's either R or Python and they all kind of want to use Python, but sometimes they use
- 26:02R, but Python just can do more things.
- 26:05So depending on what you need.
- 26:06The next episode I'm going to release, which I've already recorded, but haven't released.
- 26:10So you all don't know about it necessarily is shining for Python, which is pretty interesting.
- 26:15Like that's the R web story coming to Python, which I think is just more cool stuff you can
- 26:20do in Python, honestly.
- 26:21Actually, I need to check the Python version of that.
- 26:23Cause one of the, we just had DjangoCon Europe earlier this year.
- 26:26And one of the people who came up to me is someone who worked for the, what do you say?
- 26:30The UK government on their putting systems together.
- 26:33And he had bought my books to get his team to move away.
- 26:36Maybe started with double O or something or other.
- 26:38I don't know.
- 26:38No, not that cool.
- 26:40You just COVID information, you know, health stuff, NH, NHIS.
- 26:44Is that, is that, yeah.
- 26:45Nathan Holt, NHS.
- 26:46NHS.
- 26:47They were able, so he had said though, that they were able to use R and use the, what
- 26:51is it called?
- 26:51The webby to put things online, but for interactivity, they, that's where they hit problems.
- 26:56So he and his team of 12 had moved a lot of stuff over to Django for the, just more interactivity
- 27:02of it all.
- 27:03But this is, you know, something the British government was doing to, so I'm, yeah, it's an
- 27:07area I want to learn more about, you know, shiny and how all that works, because it's always
- 27:11been like, why can't you just take a Jupyter notebook and put it online?
- 27:14I mean, you write, like often put it online.
- 27:17So I'm trying to understand that too, because the data science space is so big in the web
- 27:21space feels small in comparison, but yeah, I look forward to that episode.
- 27:24My quick takeaway talking to Joe there was, they really thought about how to make it the
- 27:29Pythonic way.
- 27:30And it seems like they really embraced it and not just, well, we'll get it to run on Python,
- 27:34but it seems like it's going to be a good option for people out there.
- 27:37So that's really cool.
- 27:38I want to make sure that we talk about some of the history of Django and the future of Django,
- 27:42but I know something that all three of us are super excited about is HTML.
- 27:47So let's, and we were talking about the front end stuff and the back end.
- 27:51And so I don't typically share jokes on Talk Python that much.
- 27:54It's more Python bites the show at the end there, but there's this great meme and it has
- 27:58the backend dev and it has HTML two people on the HTML.
- 28:02When speaking to the backend dev says, look at me, look at me.
- 28:05HTML is talking to you.
- 28:07This is full stack.
- 28:08Now you're full stack.
- 28:09Now, come on.
- 28:10You're not just a backend developer.
- 28:11You're full stack because you're doing HTMX.
- 28:13And I think, you know, it's funny.
- 28:15Also the thing called X that is kind of Twitter and half X and partially branded that, that is
- 28:21a whole different joke.
- 28:22But I think just this, this joke up here, it really touches on, on something that I think
- 28:27makes Django makes blast, make all the Python web frameworks way more holistic and important
- 28:34back coming back to build these apps, right?
- 28:36It's not just like, well, we have to use reacts or we're going to push you to just write JSON
- 28:40and points and, and so on and so on.
- 28:42And like, no, you can actually flip that and just embrace Python more with HTMX.
- 28:47Who wants to start riffing on HTMX and Django?
- 28:49Carlton, you go ahead.
- 28:50This is more of your.
- 28:51No, it's exactly that.
- 28:52So, I mean, two years ago, three years ago, it was all like, oh, Python's existential threat
- 28:57because everything's going to be rewritten in JavaScript because, you know, everything
- 29:02on the front end is JavaScript.
- 29:03And so it doesn't make sense having these two languages.
- 29:06So it's all going to just flip over and Python's going to disappear in a puff of JavaScript.
- 29:10Well, now it's kind of like, well, really?
- 29:13Is that, is that what I see happening?
- 29:14Not, no.
- 29:15What I see is the super established mature web frameworks showing the real strength
- 29:21of the HTML tooling and the hypermedia tooling that they've, you know, it's, it's,
- 29:26it's just so fully developed.
- 29:28I mean, Django is 18 years old this summer, right?
- 29:30So there's a lot of history there.
- 29:32There's a lot of development time gone in.
- 29:33There's a lot of richness.
- 29:34And once you start using HTMX, it really is.
- 29:38It's like, oh, do you know what?
- 29:39This just fits the patterns that Django wants you to use.
- 29:43You know, it, like it works with Django forms and you just, you know, oh, look, it's just
- 29:47a form view.
- 29:48And it's just, all I do is add this little header in and oh, look, I changed the template
- 29:52maybe.
- 29:52And oh, look, it's, it's a fully interactive, rich client that the users can't tell the difference
- 29:59between that and a full SBA built with Rack.
- 30:02Or perhaps they can because it loads quicker because it's not, it's actually faster.
- 30:06And one of the great reasons for switching to SBAs was they were meant to be quicker.
- 30:10But the reality is after all these years, they're loading so much JavaScript into the
- 30:13page and doing so much work in the browser in order to get the HTML to be interactive
- 30:18that in fact, they feel slower to the user.
- 30:20So for people who don't know, HTMX lets you put attributes on HTML, not complicated stuff.
- 30:25Like if you had an image, you could say hx-get and give it a URL.
- 30:30And you could say hx-target is some other thing.
- 30:33So if you click on that image, it'll go, if this context talked Django, pull back a fragment
- 30:38of HTML and pop it with possible animations and transitions and stuff into another section
- 30:43for like a master detail, like list details, view story.
- 30:47And it's just as nice as most single page app, most friend and frameworks.
- 30:54It's, I suppose if the thing completely loaded all the different data and had zero server interaction,
- 31:00but then the startup time of that would be completely bad, like you said, Carlton.
- 31:04So it's fantastic.
- 31:05And let's go back to like the beginner and the people doing simple stuff.
- 31:09HTMX is not just for beginners, but it really works well for them because they no longer have
- 31:14to learn a different framework or never different language and a framework like JavaScript and
- 31:19view.
- 31:19They don't have to write APIs.
- 31:21They just do the thing they're doing.
- 31:22And all of a sudden all this cool interactivity comes in.
- 31:25Right.
- 31:25Yeah.
- 31:25And like for a decade, it hasn't felt to me, you know, I'm 20 years in the business.
- 31:30I know how to do quite a lot, but for a decade or so, it hasn't felt to me feasible to be building
- 31:36web good, high quality, professional quality web applications, single-handed.
- 31:40But it feels like that again.
- 31:42It feels like, do you know what?
- 31:44I don't need a whole team here.
- 31:45And with interest rates going up and inflation going up, you know, money being tight now,
- 31:49I honestly think there is a real big commercial competitive advantage coming back to sort of
- 31:56the backend.
- 31:57And that's not just Django, but Django and Flask and, you know, Rails even, if you want a different
- 32:02language.
- 32:02But those kind of stacks where you can produce a really competent crud backend in very little
- 32:09time, and then you can produce the front end that's rich enough and feels good and feels
- 32:14developed for a fraction of the team size.
- 32:17One, two developers instead of five, 10 developers.
- 32:21This portion of Talk Python To Me is brought to you by us over at Talk Python Training.
- 32:26Let me tell you about one of our really popular courses.
- 32:30HTMX plus Flask, modern Python web apps hold the JavaScript.
- 32:34HTMX is one of the hottest properties in web development today.
- 32:39And for good reason.
- 32:39You might even remember all the stuff we talked about with Carson Gross back on episode 321.
- 32:44HTMX, along with the libraries and techniques we introduced in our new course, will have you
- 32:50writing the best Python web apps you've ever written.
- 32:52Clean, fast, and interactive, all without that front end overhead.
- 32:56If you're a Python web developer that has wanted to build more dynamic, interactive apps, but
- 33:00don't want to or can't write a significant portion of your app in rich front end JavaScript
- 33:05frameworks, you'll absolutely love HTMX.
- 33:08Check it out over at talkpython.fm/HTMX or just click the link in your podcast player show notes.
- 33:14I think it also speaks to the wisdom, I would say, of, so Django has a templating language,
- 33:22but it's deliberately basic.
- 33:23You can use Jinja and Django by design because 18 years ago, the idea was, well, we're not a
- 33:29front end framework.
- 33:30Who knows what's going to happen?
- 33:31And that provides the opportunity for HTMX comes along, just slide it right in.
- 33:36Like Django is not, doesn't have all this stuff built on top of it trying to do that too.
- 33:41So that can be a frustration for beginners that why doesn't, why don't the templates do more?
- 33:45They actually do a lot, but it opens it up to HTMX.
- 33:49And then there's, you know, Django has third party package systems.
- 33:52So there's one that Adam Johnson, who's a member of the community has Django HTMX that has
- 33:56extensions.
- 33:56Like basically everything you want to do, you can kind of copy and paste it in.
- 34:01I mean, understand what you're doing, but so this is, yeah, Django HTMX is a great resource,
- 34:05but it's not, it's not rocket science.
- 34:07It's not, you know, you're not reinventing the wheel, right?
- 34:10You have a list view, detail view.
- 34:11You want to do auto scroll.
- 34:12You want to do some validation on a form.
- 34:14It's the same solved problems out there.
- 34:16You just have to know where to go.
- 34:17You can go quite far with it.
- 34:18Yeah.
- 34:18That would be an interesting question of where do you really need to not use it?
- 34:22I mean, certainly even in a team setting, like it's just such less complexity and it's arguably
- 34:29faster and it gets you what you need.
- 34:31Where do you not use it?
- 34:32So I'm building a quite rich drag and drop interface for a tool.
- 34:37It's pretty complex.
- 34:38It's pretty interactive.
- 34:39And I'm using Alpine to do that on the page.
- 34:41And then, but when it comes back to the server request, then dropping back to HTMX to send
- 34:47the things and get a chunk back.
- 34:48And I can quite often replace either a part or all of the Alpine component with the stuff
- 34:53from the HTMX.
- 34:55So it's still using rich JavaScript in the client where you need it.
- 34:59But you go an awful long way before you need that, you know, and you're dropping in forms
- 35:03and you've got a nested list view and you're dropping, you're fetching that nested list view
- 35:07and dropping that in place.
- 35:09And that's in a modal, which is perhaps powered by Alpine.
- 35:11And it looks rich and smooth and it's everything you want.
- 35:15But the amount of code is very minimal.
- 35:17It's progressive too, right?
- 35:19I mean, Vue.js, when it first came on the scene, I forget if it's still doing this, but
- 35:23like its whole thing was the progressive, you know, you don't need the full React bundle.
- 35:26You can kind of ramp your way in.
- 35:28And so I think there's just more ways to get from here to there.
- 35:31And you don't have to just go to APIs and the full-blown thing.
- 35:34And I have to admit, last week, or perhaps the week before, I was sitting there going,
- 35:39I was doing everything at HTMX and I was like, I need a full page load here.
- 35:42I need it to refresh the whole page.
- 35:44How do I do that?
- 35:44How do I do that?
- 35:45And I had to step away, go and get a coffee.
- 35:47And as I was boiling the kettle, I was like, oh, I could just submit the form normally.
- 35:53I'll fall back to just doing what the browser does by default.
- 35:56Oh, yeah.
- 35:56Okay.
- 35:56You just always have to think if it's getting clever, like you're missing something.
- 36:00Yeah.
- 36:00Yeah.
- 36:00No, it was exactly that.
- 36:01It's like, I was so in the zone that I'd forgotten the base technology I was using.
- 36:05I did a talk at PyBay Food Cart Edition a couple of years ago, and I was talking about
- 36:10it on X, whatever that thing.
- 36:13And we're going to have to figure this out.
- 36:14That thing might be gone pretty soon, but we'll see.
- 36:17Anyway, I was talking about it and I said, look, you can write these awesome web apps with
- 36:21Python.
- 36:21You don't have to use JavaScript and somebody's like, Michael, that's really insensitive.
- 36:25People, you shouldn't be degrading the JavaScript developers and that's not the message.
- 36:32It's the message that the language you choose, whatever it is, you can just embrace that and
- 36:37do a lot more.
- 36:37And the biggest example of that is that this is a popular framework in the node community,
- 36:43right?
- 36:44Which is JavaScript, right?
- 36:45And the big value here is that you don't have to also have APIs.
- 36:48You don't have to also have a front end and a back end framework in the context, right?
- 36:53Like you guys probably know is teaching and help people deploy stuff.
- 36:56It's like, well, there's what your front end can do.
- 36:58And then there's the security of the browser and there's all the constraints of that.
- 37:03And then your back end server, oh, it can talk to the database directly and it could do these
- 37:06other things.
- 37:07But with HTMX, like your front end code executes in the same context as your back end code.
- 37:12So you don't have to have like two security models, two runtime models, two all these two
- 37:16conceptual ways of like, well, what's happening here?
- 37:19So that means this.
- 37:20Like, no, it all happens in one place.
- 37:22And that's even valuable if you were doing node in JavaScript.
- 37:24Yeah, no, absolutely.
- 37:26I think there's a, on the HTMX website, there's an awesome essay.
- 37:29It could be the intercooler, but it talks about this impedance between the two sides.
- 37:34And the example it gives is GraphQL, I think.
- 37:37And the GraphQL gives amazing power onto the front end and you construct all these queries,
- 37:41but are they safe?
- 37:42And are they, who knows?
- 37:43And what companies end up, often end up doing is whitelisting the query.
- 37:47So it's in fact, you can't leverage the full expressive GraphQL in the client because it's
- 37:52only a certain number of queries which are allowed in order to get over this security problem.
- 37:56Those essays there are just phenomenal.
- 37:58We should mention, so Carlton's given two talks this year, one of them at DjangoCon Europe.
- 38:03He touches upon the locality of behavior.
- 38:06I just put in the show notes for you, Michael.
- 38:08It's one of the essays, but some of his projects, I saw everyone around me was writing down,
- 38:12perhaps you want to expound on that idea, Carlton, because it's not necessarily a new idea,
- 38:16but it really seemed to resonate at DjangoCon with people.
- 38:19The talk was called Yak Shaving to Where the Puck's Going to Be.
- 38:22And it was about, it's just been about what I've been doing since I stepped down as a fellow
- 38:25in end of March.
- 38:26So April, I sat down to start writing software.
- 38:28I had with Django again, rather than on Django, as I said at the beginning.
- 38:31And the hook that I built the whole talk around was HTMX and this idea of locality behavior.
- 38:37And so the example that I gave in the talk, which is from the essay there, is HTMX has
- 38:42got just the one HTML file open versus a jQuery example, which is very similar, but it's over
- 38:48two files.
- 38:48And it's not the only consideration.
- 38:51But in that one case, you've got one file open versus two files open.
- 38:55Well, there's better locality of behavior where you've got one file open.
- 38:58And that really, when I read that essay, it really struck a bell with me.
- 39:02For years, I've been talking to clients about this.
- 39:04And you've got a form, a Django form, and it's perhaps only got four lines or three lines.
- 39:08It's virtually nothing.
- 39:10And it'll be off on its own in a separate forms.py file rather than next to the view you're
- 39:15working on.
- 39:15And so you have to go and open that second forms.py file to see the form.
- 39:19And it's always just declares the fields.
- 39:21And that's all it does.
- 39:21And then you go back to the view.
- 39:22And you have to kind of remember it was if you just move that form kind of next to the
- 39:27view, all of a sudden, it's all within one screen on your editor.
- 39:31And it's much easier to understand.
- 39:33And then your speed of development increases.
- 39:36And the more I've been playing with this, the more I've used this, it's just like, yeah,
- 39:40actually, I'm able to work much faster by focus, particularly of a new code.
- 39:46Like when your code starts to get bigger and more gnarly and more curly, and there's more
- 39:49bits to it, then okay, you want to break it out so that it remains maintainable.
- 39:54But when you're first working on it, and there isn't much of it, and it's constantly in flux,
- 39:58keeping it all together, it just helps you go faster.
- 40:01It's this idea of locality of behavior.
- 40:03It's phenomenal.
- 40:04I'm just a massive fan of it.
- 40:06Yeah, it's really a brilliant framework.
- 40:08And so for Django people, Django-htmx, that's where the magic is to get it easily integrated?
- 40:15Yeah.
- 40:15So the basics of that is a middleware, which will add an htmx attribute to the request object,
- 40:20which lets you query it.
- 40:21So is this an htmx request?
- 40:23Has it got this header?
- 40:24Is it wanting to redirect?
- 40:25Is it wanting to do a full page refresh?
- 40:27Is it got the various headers that htmx sends that will embed those and a few other niceties
- 40:32as well?
- 40:33But yeah, you may as well use that.
- 40:34That's a good package from Adam, who's one of the cool...
- 40:37Adam knows what he's talking about.
- 40:38Nice.
- 40:38All right.
- 40:38Django, 18.
- 40:4018 years old.
- 40:41Yes.
- 40:42Amazingly.
- 40:43Amazingly.
- 40:43It's old enough to vote.
- 40:44Yeah, old enough to vote.
- 40:45Yeah.
- 40:46It is old enough to vote.
- 40:47Not to drink yet, so it's not going to get into trouble on the server for a few more years.
- 40:51It is on its holiday in Europe.
- 40:53Yeah, okay.
- 40:53Well, that's true.
- 40:54Yes.
- 40:54Okay.
- 40:54In Europe, it actually, it totally is.
- 40:57I remember when we lived there, my daughters were 16 and we took them out for their 16th
- 41:01birthday.
- 41:01So yeah.
- 41:02Yeah.
- 41:02But in the US, we have these rules, you know.
- 41:04Two things.
- 41:04So Django has major releases updated every eight months.
- 41:07So 4.2 came out in April, 5.0 come out in December.
- 41:12In between, there's 4.2.1, 4.2.2.
- 41:15This is all the work the fellows, Carlton, would do.
- 41:18But there's also, so in the Django News newsletter, there is almost every day, there is a new PR
- 41:23accepted and merged into Django.
- 41:26So on the Django News newsletter, one of the things we have now is a section highlighting
- 41:30like the changes this week.
- 41:32And I think last week, there were 18 new PRs.
- 41:35And that's not just someone opening it up.
- 41:37That's like open, discussed, accepted, reviewed.
- 41:40Like there's so much activity going on.
- 41:43So even as it's 18 years old and it is mature, there is still just so much happening.
- 41:48And I think that's one of the messages, Carlton, I try to get to people is like, it's not just
- 41:51this static thing at all.
- 41:53There's so much that's happening.
- 41:55And yet it won't break on you, unlike some other newer technologies.
- 41:58I mean, talk about the influx of tickets.
- 42:02Just why does Django need fellows?
- 42:05The reason it needs fellows is because there's basically five new tickets every single day.
- 42:09There's over 1,000 new tickets a year, 1,200 new tickets a year, every year.
- 42:13And they keep getting handled.
- 42:15They keep getting dealt with.
- 42:16The PRs keep getting merged.
- 42:18The security releases keep coming.
- 42:19And without the fellows, it just wouldn't have happened.
- 42:21Django would have sort of just ground into an ever bigger ball of unanswered tickets, unresponded
- 42:27things.
- 42:28And so it's a project of such a size that without the paid role, it just wouldn't be maintainable.
- 42:34Some of these do get resolved.
- 42:36I mean, how long was Lily's one on database constraints?
- 42:38That was like 13 years, 12, 13 years.
- 42:41Tell that story.
- 42:42This is one of my favorite features of Django 5.0 that's coming out.
- 42:44So we haven't even talked about Django 4.2, but Django 5.0 is coming out soon.
- 42:48And in there, so there's some really big ones.
- 42:50There's database defaults.
- 42:51So on a model field, you've always been able to declare a default value.
- 42:56So if there isn't one, give it a date time field, give it now as a classic default.
- 43:01But from 5.0, you'll be able to declare those as database defaults, which may not sound like
- 43:07much.
- 43:07But A, it's quicker.
- 43:08It's moving work into the database.
- 43:09But B, not every connection to your database goes via your Django application.
- 43:13So you're able to have database level default.
- 43:15And so if there is a script which isn't using the Django ORM, then you still get the value
- 43:20of that.
- 43:20And that ties in with work that's been done on constraints with database constraints have
- 43:25been massively powered up.
- 43:26And they'll even now, you know, your form generation will generate validators that are based on the
- 43:31database constraints.
- 43:32And it's just so much richness coming in.
- 43:35I think, I really think we're also going to get database cascades in Django 5.0.
- 43:41It's nearly ready.
- 43:42There's a month or so before the feature freeze.
- 43:44I think it's going to go in, in which case we're going to have DB defaults and DB level cascades,
- 43:48both, you know, added to Django.
- 43:50Both of those, it's a decade or more in the resolving in a new release.
- 43:55And it's just, oh, wow, that's really exciting.
- 43:57Yeah, for a lot of people, a lot of companies, the database is the source of truth for the
- 44:03apps, right?
- 44:04And like, sure, your code may talk to it, but what is in the database?
- 44:07Like there are people whose job it is to defend the schema.
- 44:10They call them DBAs, right?
- 44:12So Django 4.2 added DB comments.
- 44:15So you could add schema level comments to your model fields to explain the use of the model
- 44:20field.
- 44:20Again, it's for those scenarios.
- 44:21Yeah.
- 44:22For people who are serious about the databases, these features are just massively important.
- 44:26Yeah, I think it's certainly worth considering that there will be other apps, there will be
- 44:31other tools, and maybe even data science, right?
- 44:33The data science angle is huge.
- 44:35Often wants to now talk to the database.
- 44:37And even if it's in Python, it's unlikely that in Jupyter, you're going to pull in your
- 44:42ORM.
- 44:42You're probably using some other data science oriented library to talk to that.
- 44:47And so pushing those defaults down is valuable.
- 44:49Well, so Michael, you're as situated as anyone to answer this.
- 44:51Carlton and I are in the Django world, but how do we bridge the data science to web?
- 44:56It doesn't need to be Django world.
- 44:57Like what do they need to be on the web?
- 44:59And if so, like what's holding them back?
- 45:01Because it just feels like this mega, megaton star of data science and this tiny little web
- 45:06thing.
- 45:06But like, how do they share stuff?
- 45:07How do they interact with it?
- 45:09Yeah.
- 45:09You've got your notebook and then you want to publish it somewhere, right?
- 45:11Like, yeah.
- 45:12Or just share it, share your information.
- 45:14Or you have a database of COVID things.
- 45:17For example, in the UK, you want to put online, but let people make change in some way or make
- 45:21requests.
- 45:22I mean, the data isn't generally static.
- 45:24So I think there's two answers from my perspective.
- 45:26I think there's, there are the frameworks that are doing that.
- 45:29And that would be things like streamlit dash, not dashly, but the other dashboarding one.
- 45:35There's panel, I'd say streamlit, probably start with that one, right?
- 45:39So those kinds of things where you can get like kind of a simplified view that's kind
- 45:43of an interactive thing.
- 45:44You wouldn't look at it like we're looking at this Django site and go, yeah, it looks like,
- 45:48it feels like this, right?
- 45:49It doesn't feel like that.
- 45:50It feels like you pushed a kind of a interactive generic UI up.
- 45:54But I think that's a pretty good answer for a lot of people.
- 45:56I think another is honestly, the stuff with HTMX, right?
- 46:01You need a lot of interactivity in many of these things, these data screen screens and
- 46:06like to get that interactivity often.
- 46:08But you also need it to remember.
- 46:10Yeah, yeah.
- 46:11I mean, you need it to remember.
- 46:12We computed this stuff and I want it to like get me the other info.
- 46:16And you kind of need, just because how long it takes to do a lot of the computation, you
- 46:21want a somewhat stateful type of behavior.
- 46:23And I think HTMX with Plotly or something like that, even Matplotlib, I've done some
- 46:28Matplotlib stuff and just like returned it as an image in different areas.
- 46:32And yeah.
- 46:33What do you, Carlton, what do you think?
- 46:34Yeah, no, I'm nodding.
- 46:35That's a good approach because, you know, you can quite easily put in a little loading
- 46:39indicator there and it'll, when the HTML is ready and just, even if it took the same
- 46:44amount of time by just putting in that little animation while it loads, it feels as if it's
- 46:48responsive and doing something and it's, it's not rocket science, but.
- 46:51A little HX dash indicator.
- 46:52Yeah.
- 46:53Yeah.
- 46:53I was nodding particularly when you said just use Matplotlib and pull it in as an image.
- 46:58It's like, yeah, that works.
- 46:58That goes an awful long way doing that kind of thing.
- 47:00I wasn't familiar with Streamlit.
- 47:01That's really cool.
- 47:02I mean, it makes sense.
- 47:03I'm like, there's got to be someone, some people doing this, solving this problem.
- 47:06But yeah, Streamlit is really, really interesting.
- 47:09Basically you put deck, you have like a regular script that's not even a web thing and you put
- 47:14decorators onto the functions and it says, oh, this parameter here is going to be a
- 47:19combo box or something.
- 47:21And it knows how to like wire the, it's some voodoo, but it's cool.
- 47:25But it does look like a Streamlit app, right?
- 47:27It doesn't look like, well, here's my own custom website.
- 47:30It's like, well, here's my Streamlit app that I built for you.
- 47:32Right.
- 47:32So there's.
- 47:33But I mean, and yet, you know, many people are using Tailwind now.
- 47:36And so every site looks like a Tailwind site and before it was bootstrapped and before,
- 47:40you know, so it's like, we can't get too high on our horse about it, you know, because
- 47:43at the end of the day, it's like, it just needs to look modern-ish and like move on.
- 47:47Yeah, absolutely.
- 47:48Absolutely.
- 47:49And getting something out is super important.
- 47:51Okay.
- 47:51So Django is, I would say it is the oldest popular Python web framework period, right?
- 47:58There may have been ones before, but it certainly seems to be of the few that are like really,
- 48:03really popular.
- 48:04The one that's been around the longest.
- 48:06What's amazing for me about it is the way the community kind of keeps refreshing itself.
- 48:11Like it's not like the founders of Django are still merging every commit and every PR far
- 48:17from it.
- 48:17But, you know, I think Simon Willison made a commit in either 4.1 or 4.2.
- 48:21I can't remember.
- 48:22It was his first one for six years.
- 48:23He doesn't even live in Lawrence anymore.
- 48:26I mean, come on.
- 48:26None of them do.
- 48:27Exactly.
- 48:27What right has he got?
- 48:28But the point being is that it was set up deliberately to like hand it on and let it go.
- 48:34And it's, I think Django is probably on its fourth or even fifth cohort of generation of kind of maintainers
- 48:39now and yeah, that's a whole fresh batch of faces in the community who are doing new and exciting things.
- 48:45And it's just so wonderful to see because you get old and long in the tooth and think, oh, I'm worried about the future of Django.
- 48:52No, Django is doing great.
- 48:54At DjangoCon, we talk about Django things.
- 48:57And one of the things we don't necessarily describe to others is what makes Django different than other frameworks out there.
- 49:03And it is the community.
- 49:05You know, I mean, like Flask is an amazing resource and David Lord and people do great work, but there's no Flask cons.
- 49:12There's no, it's its own thing.
- 49:14But Django is relatively unique in that it has, it's a nonprofit.
- 49:18It has fellows.
- 49:19It has conferences.
- 49:20It has this whole ecosystem, third-party packages.
- 49:22You know, so there's the saying, you know, come for the framework, stay for the community.
- 49:26It really is true, but you can't get that across to someone who just looks at the Django website, which looks like what it is, which it hasn't been redone in a number of years.
- 49:34Right.
- 49:34You think, oh, maybe it's a little bit of a stale, crusty Python thing.
- 49:37It's like, no, it's alive.
- 49:38There's changes every day.
- 49:40You're just not seeing it.
- 49:41And it's hard to, you're HTMX, right?
- 49:43Like Carson does amazing work, but I think it's pretty much just him, right?
- 49:47It's not this community of dozens and dozens of people.
- 49:50And so one of the exciting things for Carlton and me is we're both transitioning away a little bit, but still helping bring in new people.
- 49:57And that's healthy, right?
- 49:58Like we know a bit, but sometimes I get, you know, I know the things that kind of I would like to change that may not change as quickly.
- 50:04And then new people have great ideas and enthusiasm.
- 50:06And it's like, yes, let me support you because I don't want to get stale with this.
- 50:10Project Vaughn asks a pretty good question, which I think is a good question for any really large project that's been around a long time.
- 50:16It's like, how do you get more involved with Django?
- 50:18For someone who's not proficient in Django, like super, super proficient, given that it's a mature project, it's really hard to get that first PR written.
- 50:27One thing that often comes up, oh, there's no ease, there's no low hanging fruit.
- 50:31It's a mature framework.
- 50:32There's nothing easy to do.
- 50:33And it's like, well, yes and no.
- 50:34Yes and no.
- 50:35There are very few like nothing fixes, you know, that an absolute beginner can just come in and get, because they get snapped up really quickly and they just don't hang around for very long.
- 50:44But we've got something like 800 open accepted tickets on Django.
- 50:48Now of those 800 tickets, some of them are truly hard, like adding database defaults, which took a dozen years and five Django con sprints and, you know, who knows what to actually get over the line.
- 51:00That's truly hard.
- 51:02But most of the tickets aren't like that.
- 51:04Most of the tickets are no harder than a problem that you're solving in your everyday Django or Python programming work.
- 51:10And what they need is time and love.
- 51:13And so Django cons, I've run Django cons sprints.
- 51:16I've run a kind of getting contributed workshop.
- 51:17And the goal of it, you've only got a couple of hours.
- 51:19It's only like half a morning.
- 51:20And the goal is not to necessarily get your PR in, but it's just to get you to look at a ticket in a bit of depth, get set up with a test suite, you know, install it, get set up.
- 51:29But get involved in a ticket and come to understand that ticket and realize that actually after that, a couple of hours of thinking about that ticket, you are literally the world expert on that ticket.
- 51:39And even though you're not like, oh, it's established.
- 51:41I'm not a Django fellow.
- 51:43I'm not an established contributor.
- 51:44You, as the world expert on that ticket, you have a valid opinion and your insight will be valuable.
- 51:50And yes, you have to dig around and you have to learn some source code.
- 51:54But you'll have an idea and it's going to be on the right track.
- 51:57And if you put the time and work and love in, you'll be able to resolve that ticket.
- 52:01And once people have had that experience, then it's like, oh, I can do another one and I can do another one.
- 52:06And it can become the little side hobby.
- 52:08And actually then I'm a Django contributor.
- 52:10So it's take your time, pick a ticket, really focus on it, become the world expert.
- 52:15And in so doing, even if you don't resolve the ticket, you will learn an awful lot about Django.
- 52:20You think you know Django by developing Django apps all day.
- 52:23Well, you start digging around in the code, I'll guarantee you'll know it a lot better afterwards.
- 52:27So that would be what I say is find a ticket that grabs you and just take that little bit of time to really understand it.
- 52:34Yeah, that's great advice.
- 52:36I guess there's probably sprints you could drop into at some conferences.
- 52:39Yeah.
- 52:40So after the Django cons, there's two days of sprints.
- 52:42Stay around.
- 52:43There's a really great opportunity to meet people who are contributing and to get into contributing and be able to sit in the same room as somebody and say, well, you know, how do I get started?
- 52:52How, you know, that is a good, a good play.
- 52:54But can I just sit there and look over your shoulder as you two work on this?
- 52:58Yes.
- 52:58Let me be.
- 52:59That was the most recent Django con.
- 53:01So there's Django con US, Django con Europe.
- 53:02There's going to be a Django con Africa this year for the first time.
- 53:05But the most recent Django con US, I was at a sprint talking with David Lord, who's the lead maintainer on Flask.
- 53:11And he had a question about something or other.
- 53:13And someone was like, oh, like Simon Willison knows about that.
- 53:15So I was like, oh, grab Simon over.
- 53:17And they'd never met.
- 53:18And now it's like, oh, like, so if you can stay for the sprints, it seems like the nothing part.
- 53:22It's actually I'd almost take the sprints over the conference if you could, because it's literally just like anyone you want to talk to.
- 53:29And you don't have to, you know, like, what are you working on?
- 53:32Or, yeah, they're like the best part.
- 53:33But maybe it seems intimidating, but it's really not.
- 53:36And to Carlton's point, the community really is welcoming.
- 53:38So even especially if you're inexperienced, if you're making an effort and people can see that they will be encouraging and want to loop you in.
- 53:46There's also I should mention there's a new link program called Django Knot that's trying to pilot having some mentors to give this kind of hands on help a little bit.
- 53:55That's a new program.
- 53:56It's only, I think, six people right now, but there's they're trying to foster more mentoring of this type.
- 54:02But it is a challenge for a mature framework, right?
- 54:04You probably can't just go fix HTML.
- 54:06It's probably a little more meaty, but it's not all hard just because it's there.
- 54:09It's just that it got stuck for whatever reason.
- 54:11It needs, as Carlton said, that of someone to come in and put a couple hours and then be the world expert.
- 54:16Absolutely.
- 54:17So what's the async story Django these days?
- 54:21How's it looking?
- 54:21It's looking really good.
- 54:23Well, do we get to talk about 4.2?
- 54:25Yes.
- 54:26Django 4.2 brought in async support for streaming responses.
- 54:31So within the core framework itself, you can do server-sent events or, you know, you can have a request come in.
- 54:37You can keep it open without blocking the worker and you can periodically send messages down.
- 54:41That's really quite exciting in 4.2.
- 54:43And with the other thing that came in 4.2 was Psycho PG3, which allows async database connections.
- 54:51And so there's a link in the show notes there of somebody put together exactly what I was hoping for, which was the chat, the chat example, but done 100% async.
- 55:01So without blocking the blocking ORM call with the server-sent events, so instead of long polling or without having to use an add-on like channels, which, you know, add-on channels is great if you need it.
- 55:10But isn't it cool that you can do server-sent events just in Django?
- 55:15And then in 5.0, which is coming, we're going to have HTTP disconnect handling in, so those long-lived requests, if the client disconnects, you'll get an asyncio cancel there in your view and you'll be able to respond to it and do any cleanup.
- 55:27We've also, in 5.0, we're going to have async signals, which gives you an 100% async request-response pathway if you want it, because before the only blocking bit there was the signals, which were synced.
- 55:39So you still had to do this sync to async, jump into a thread pool to dispatch the signals.
- 55:45But that, if you've got async signal handles, will all be async as well.
- 55:49So the entire request-response flow can be async.
- 55:51And then sessions is going to be async in 5.0 as well.
- 55:55Auth is going to be async as well in 5.0.
- 55:59So those kind of core flows are, this is on top of the async interface to the ORM, which was added.
- 56:05You know, it's all fleshing out.
- 56:07And there's a few decorators, which, you know, aren't yet done, but they'll be done over the next few releases.
- 56:12It's really enriched.
- 56:14And it's like, yes, yes, five, six years, seven years of work has gone into this.
- 56:19And it's really maturing nicely.
- 56:21So I think async in Django is a very, very exciting time.
- 56:24So when people say, I want a FastAPI, right?
- 56:27That's always the thing.
- 56:28Well, why not just use FastAPI?
- 56:29Well, no.
- 56:30If you want to use FastAPI, go use FastAPI.
- 56:32But if you're using Django, but you need a couple of these endpoints, which you need higher throughput or, you know, a real-time or two-directional traffic or whatever, you shouldn't have to switch red framework just to have a couple of these endpoints, right?
- 56:45It's like Python needs to be in every area because you shouldn't have to switch language just because you need, I don't know what, to be a bit more serious about things.
- 56:53So Python needs to be able to account for those more serious use cases.
- 56:56Well, same with Django.
- 56:57It needs an async story because you shouldn't have to change your web framework just for, you know, service center events or I don't know what other async, you know, a bit of real-time.
- 57:05Almost nothing waits on other things like web frameworks do.
- 57:08They wait on database calls.
- 57:10They wait on the network.
- 57:12They wait on caches, you know, like Redis.
- 57:15They wait on maybe calling other APIs.
- 57:18Like, almost everything they do is coordinating other systems and waiting and then turning that to HTML or JSON.
- 57:24And so having rich async support is fantastic.
- 57:27Yeah, no, I mean, it's really coming on.
- 57:28And there are still, you know, there are bits inside, you know, I don't know if you need the, I don't know, user passage test, decorate, permissions decorator.
- 57:36Is that yet async defy?
- 57:37I'm not sure if it is.
- 57:38But okay, that's not, we haven't got to, maybe we have, I need to check, but we haven't got to that bit yet.
- 57:43But okay, those kind of bits, we'll get there with those.
- 57:46But that kind of call, I'm building something on the request response cycle with auth, with sessions.
- 57:52Yeah, that's all now done.
- 57:53And so it's really maturing.
- 57:54Getting short on time here, guys.
- 57:56It's so nice to have you be in charge of this, I should say, right?
- 57:58Because whenever there's those pauses, like my instinct is to jump in and like, look at our notes.
- 58:02But like, just like, nope, you're captain of the ship.
- 58:05It's so nice.
- 58:06Yeah.
- 58:07We're just out for a sunset cruise in the whole boat.
- 58:11We're coming back to the harbor.
- 58:13So what else about the future, right?
- 58:15We talked about Django being 18, a lot of the cool ideas and projects and resources.
- 58:20But what about the future, some of which we just covered is really exciting.
- 58:24Maybe we haven't given time to yet.
- 58:27I'm personally excited about the new people getting involved.
- 58:29I know that's not as tangible for folks, but coming from Django Cons, coming, like I just stepped off the board as treasurer for three years.
- 58:37I know who the new treasurer is, the current president.
- 58:41Like, I'm really excited about the new people.
- 58:43And so I don't, for a while during COVID, I think some of us had concerns about like, you know, how do we keep this afloat and not have everything crash and burn?
- 58:51But I don't have those concerns anymore.
- 58:54Yeah, yeah, yeah, yeah.
- 58:56Just the fact that if you want something in Python that solves almost every web problem you have and has a really supportive community, Django is still there for you.
- 59:03And so I guess that's the big one.
- 59:05It's just, and I think from a marketing side, it's just how do we express that it's still cool and interesting and powerful and yet won't break on you.
- 59:13It doesn't seem as shiny and new as the next whatever.
- 59:17But it's, you know, it's like if you look on Hacker News every like six months, someone's like, wow, Django is like still around.
- 59:22Oh, it's like kind of solves all these problems we have with this new JavaScript this or that.
- 59:26And it's like, yeah, it's still just doing its thing.
- 59:29So I would say the community side.
- 59:31I mean, also like I've got projects.
- 59:33If you want to learn Django, I mean, like, let me, there's a lot of resources to learn it.
- 59:37There's a number, there's videos.
- 59:38You have videos, books, tutorials, like some of these newer technologies.
- 59:42It's harder.
- 59:43There's not a community and it's harder to find the resources.
- 59:46You know, there's a lot of strength in being around for a while and yet not being totally stale.
- 59:50So that would be my tagline for Django.
- 59:52How's that?
- 59:53I kind of go off that.
- 59:54I think actually it is cool.
- 59:56And it's about as cool as it's been for a while.
- 59:58I said in my DjangoCon Europe talk that I'm as excited about the framework and where it's going now as I have been for many years.
- 1:00:05Since I said since the DRF Kickstarter, if you remember that back in the day.
- 1:00:09There are over the last few releases, and I don't just mean 4.2 and 5.0 coming up.
- 1:00:14I mean, like the last 3.2, 4.0, 4.1, like last few years, there've been a number of threads, not just the async stuff.
- 1:00:22There's been massive changes to the forms, templating.
- 1:00:24There's been all these changes to the ORM that are powering up every single release.
- 1:00:28And they've all come together.
- 1:00:29And there are patterns now to be discovered.
- 1:00:33And it's like I said, I'm stepping down in part because of life, but in part to get back to working with Django rather than just on Django.
- 1:00:40I want to play with all of these new toys that we've built over the last few releases.
- 1:00:45And I want to discover those patterns and see them codified and see them come out in the community.
- 1:00:49And it's just a massively fertile time.
- 1:00:52And so that's what I'm excited about.
- 1:00:54That's where we're going.
- 1:00:54And I can't say every release Django literally gobsmacked by how many new features you think are there won't be any in the new one.
- 1:01:01But 5.0 is coming out.
- 1:01:05And it's just hitting you out of the park again.
- 1:01:07And it's like, wow, we've only just had 4.2.
- 1:01:094.2 is not even old yet.
- 1:01:105.0 is not even in alpha.
- 1:01:13And we're already thinking, oh, can we run it off main?
- 1:01:15Because it's so exciting.
- 1:01:16The future is so many things have come together.
- 1:01:18And the future is just really exciting.
- 1:01:20I feel like I would be bored by now with Django.
- 1:01:23I've only been doing it for over a decade.
- 1:01:25But if anything, there's just so many new features.
- 1:01:29But also, I'm understanding built-in functionality even better to solve problems that I just didn't have before.
- 1:01:34So at some point, maybe I'll be like, oh, I know it all.
- 1:01:37But I feel the opposite.
- 1:01:38I feel like, whoa, I had no idea.
- 1:01:40Just one concrete example.
- 1:01:41Doing all the work with templates and HTMX.
- 1:01:44And coming to see the patterns about creating, again, fresh for the first time and really using templates for the first time in half a decade.
- 1:01:51It's like, okay, ah, yes, I create a template tag here.
- 1:01:55And I do it this way.
- 1:01:55And I put a mapper in here to create a kind of view model type thing.
- 1:01:59So I pass in an ORM model object into the template tag.
- 1:02:01And then in the template tag, I map it to what I need in the actual template itself.
- 1:02:05Then the template comes in.
- 1:02:06It's like, oh, that's a really good and powerful pattern.
- 1:02:09And it's really encapsulated and neat.
- 1:02:12And it makes my template expressive.
- 1:02:14And oh, rediscovering these things.
- 1:02:17And then being able to say, right, okay, well, what changes does the Django template language need that it hasn't had in quite a few years because no one was using it?
- 1:02:24And yeah, it's just a massively fertile time.
- 1:02:27It is.
- 1:02:27And it's no coincidence that we've been hitting on HTMX so much because it really puts the power of frameworks like Django back front and center in how you think about building and structuring your web apps.
- 1:02:41It's not like, well, there's this thing in the backend and then we're going to go do these other languages.
- 1:02:44It's like, you know, actually it could be all.
- 1:02:46And there's a bunch of cool features and capabilities that we've been talking about.
- 1:02:49And you can use them throughout your app if you leverage something like, not necessarily, but something like HTMX, which is really cool, I think.
- 1:02:57For me, it works just with the grain of the framework.
- 1:02:59It's like, this is the way I would do it if I was writing in 2005.
- 1:03:03And I do it exactly the same in 2023.
- 1:03:06And it just works.
- 1:03:09And it's, you know, responsive and dynamic and all these nice things that, you know, clients want.
- 1:03:15Absolutely.
- 1:03:15All right.
- 1:03:16Let's leave it there, guys.
- 1:03:17Thank you so much for covering all this and celebrating Django's 18th birthday.
- 1:03:2318th birthday, yeah.
- 1:03:24Yeah, it's awesome.
- 1:03:26It is an adult and it's a cool framework for sure.
- 1:03:29With really, I think it's the community behind it, especially the fellows and all the board and stuff.
- 1:03:36It makes it really unique and is certainly worth considering as part of the framework, right?
- 1:03:40As you said.
- 1:03:41Okay.
- 1:03:41With that, let's round this out with just a final shout out to what you guys have around Django.
- 1:03:48For example, the Django chat podcast, right?
- 1:03:51Which is excellent.
- 1:03:52Give us a shout about that.
- 1:03:53You know, Will, tell us about Learn Django and maybe Button.dev or whatever else you want to throw in.
- 1:03:58I should say Django chat.com.
- 1:04:00You're sort of the godfather of it because you gave me a lot of good advice when we were starting out in the early days around things and that there might be a market for it.
- 1:04:07So thank you for that.
- 1:04:08You're welcome.
- 1:04:09It's going strong.
- 1:04:10It's a great show.
- 1:04:11I enjoy listening to the episodes.
- 1:04:12We're going to be back in the fall with new episodes.
- 1:04:14And then learnjango.com.
- 1:04:15That's my main website.
- 1:04:16If you want to learn Django, access books, lots of free tutorials, premium ones coming.
- 1:04:21That's sort of an all-in-one resource.
- 1:04:23And I think there's also a link to Django-news, which is a weekly Django newsletter with new news that's happening, new projects, new tutorials, not just mine.
- 1:04:32So that's something I've been doing with Jeff Triplett for a number of years now.
- 1:04:35And that's a good way to stay in tune with what's happening.
- 1:04:38Yeah, that's kind of an essential resource, I'd say.
- 1:04:40And then Button, Carlton.
- 1:04:41Yeah, so okay.
- 1:04:42So I've got a website and I've got a blog somewhere.
- 1:04:46So button, btn.dev, that'll be live in the autumn now.
- 1:04:50But you can follow me on Fosadon or the Fediverse.
- 1:04:54And on my website, there's an RSS feed, which you could subscribe to if you fancy that.
- 1:04:58My other big projects at the moment is working on a set of opinionated CRUD views for Django called Neapolitan, which is a bit of fun.
- 1:05:06I'm having a lot of fun with that.
- 1:05:08So watch my DjangoCon Europe talk for an introduction of that.
- 1:05:10And then I'm working on a package called DjangoTemplatePartials as well, which is about getting template fragments into the DjangoTemplate language, which again...
- 1:05:18I was going to ask you about that.
- 1:05:19I know.
- 1:05:20Now that he's not a fellow, he can do all the things he always wanted to.
- 1:05:23Yeah, when I started using this with...
- 1:05:25Oh, yes.
- 1:05:26And I'm like, man, you have got to come up with a way to reuse HTML almost like functions.
- 1:05:34So I came up with JinjaPartials.
- 1:05:35So what is yours called?
- 1:05:37DjangoTemplatePartials.
- 1:05:38TemplatePartials.
- 1:05:39DjangoTemplatePartials.
- 1:05:39Oh, oh.
- 1:05:40You need a spacer.
- 1:05:41I think I put a link in the notes.
- 1:05:43But yeah.
- 1:05:44Yeah, there you are.
- 1:05:45There you are.
- 1:05:45So that's my take.
- 1:05:47And it just enables you to define reusable components.
- 1:05:50There's a couple of pull requests open, which will just change the API there slightly.
- 1:05:54And then we'll start to think about rolling into Django.
- 1:05:57Hopefully for now, it's going to be Django 5.1.
- 1:06:00There's no chance of me getting in for 5.0 this summer.
- 1:06:02But it's the same idea.
- 1:06:04And the point with it is it's integrated with the Django template loader.
- 1:06:08So all you do in your view is change your template name variable.
- 1:06:12And you still return your template response, same as you always had with the context.
- 1:06:16There's no adjusting your view logic.
- 1:06:18It's almost transparent to the view layer.
- 1:06:20And there are, you know, I've seen people writing logic where they pass the HX vowels, which is where you pass extra parameters in your request from the client, which you could then specify the partial with.
- 1:06:31And then your view logic wouldn't change at all.
- 1:06:33That's out of scope for Django template partials.
- 1:06:35But it's a possibility.
- 1:06:37But the point being that you just, it's this for me or something like it is how Django wants you to do partials with the Django template language.
- 1:06:45Obviously with Jinja, there's an option as well with Django.
- 1:06:49Useful outside of HTMX required for HTMX, basically, right?
- 1:06:52Yeah.
- 1:06:53I mean, because what's the other way?
- 1:06:54The problem with it is you then have, if you don't have inline partials, you have to move it to a separate template.
- 1:07:00And then you have to include that template in the other template.
- 1:07:03And that's great at a certain level of complexity.
- 1:07:05But again, it's this locality behavior thing.
- 1:07:08When you're first starting, you don't want that heavy weight kind of in your creative flow.
- 1:07:12You're making progress.
- 1:07:14And all of a sudden, you have to put the brakes on to create a new file, move it open.
- 1:07:17What's the file name again?
- 1:07:19Oh, I've spelled it wrong.
- 1:07:20Oh, it didn't load.
- 1:07:21Oh, because it was in the wrong file.
- 1:07:23You don't want all of that.
- 1:07:24You just want inline that bit.
- 1:07:26Be reusable, please.
- 1:07:27Yeah, very cool.
- 1:07:28Yeah, this is different.
- 1:07:29Mine doesn't embrace the locality behavior as much as yours does.
- 1:07:32So people should check this out.
- 1:07:33This is interesting.
- 1:07:34Obviously, mine doesn't work with Django either.
- 1:07:36So it doesn't really matter.
- 1:07:37Well, it works with Jinja, though, right?
- 1:07:38It works with Jinja, right?
- 1:07:40Yeah, yeah, yeah.
- 1:07:40Right.
- 1:07:41So the Django templates have swappable backends.
- 1:07:45So you can use the Jinja backend to use Jinja templates with Django if that's your cup of tea.
- 1:07:49We got to end this podcast.
- 1:07:50But if you're looking at moving a Flask project over to Django, that would be a way to not touch
- 1:07:57the HTML very much, right?
- 1:07:58Yes, exactly.
- 1:07:59Because you could carry on using your same templates more.
- 1:08:01You might need one or two edits to the, what's it called?
- 1:08:04The Django environment, the Jinja environment or something to, I don't know.
- 1:08:08Thank you guys for being on the show.
- 1:08:09It's always a great time to catch up with you.
- 1:08:12Yeah, thank you for having us.
- 1:08:14This has been another episode of Talk Python To Me.
- 1:08:17Thank you to our sponsors.
- 1:08:19Be sure to check out what they're offering.
- 1:08:20It really helps support the show.
- 1:08:22Take some stress out of your life.
- 1:08:24Get notified immediately about errors and performance issues in your web or mobile applications with
- 1:08:29Sentry.
- 1:08:30Just visit talkpython.fm/sentry and get started for free.
- 1:08:35And be sure to use the promo code talkpython, all one word.
- 1:08:38Want to level up your Python?
- 1:08:40We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:08:44Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:08:49And best of all, there's not a subscription in sight.
- 1:08:52Check it out for yourself at training.talkpython.fm.
- 1:08:55Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
- 1:08:59We should be right at the top.
- 1:09:01You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:09:06and the direct RSS feed at /rss on talkpython.fm.
- 1:09:10We're live streaming most of our recordings these days.
- 1:09:13If you want to be part of the show and have your comments featured on the air,
- 1:09:17be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:09:21This is your host, Michael Kennedy.
- 1:09:23Thanks so much for listening.
- 1:09:25I really appreciate it.
- 1:09:26Now get out there and write some Python code.
- 1:09:28You
- 1:09:30You
- 1:09:32You
- 1:09:34You
- 1:09:36You
- 1:09:38You
- 1:09:40You
- 1:09:42You
- 1:09:44You
- 1:09:46Thank you.
- 1:09:48Thank you.