Learn Python with Talk Python's 270 hours of courses

#301: Deploying and running Django web apps in 2021 Transcript

Recorded on Tuesday, Jan 19, 2021.

00:00 Have you been learning Django and now you want to get your site online?

00:03 You're not sure about the best way to host it or the trade-offs between the various options?

00:07 Maybe you want to make sure your Django site is secure.

00:09 On this episode, I'm joined by two Django experts, Will Vincent and Carlton Gibson.

00:15 Talk about deploying and running Django in production, along with recent updates in Django 3.2 and beyond.

00:21 This is Talk by Thunder Me, episode 301, recorded January 19th, 2021.

00:27 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

00:46 This is your host, Michael Kennedy.

00:48 Follow me on Twitter where I'm @mkennedy, and keep up with the show and listen to past episodes at talkpython.fm,

00:54 and follow the show on Twitter via at Talk Python.

00:57 This episode is sponsored by Square and Linode.

01:00 Please check out what they're offering during their segments.

01:02 It really helps support the show.

01:04 Before we get to our discussion, just one quick announcement.

01:07 We started live streaming the recordings of Talk Python to Me episodes on YouTube.

01:11 If you're part of the live stream, you'll have a chance to ask questions,

01:14 and your comments might get featured on the air.

01:16 Just visit talkpython.fm/youtube to subscribe to the channel and see upcoming and past live streams.

01:21 Now, on to the show.

01:22 So, Carlton, Will, welcome to Talk Python to Me.

01:27 Again, welcome back, guys.

01:28 Yeah, thank you.

01:29 You came on our show, and I was on your show three years ago.

01:32 So, Carlton's first time on your show.

01:34 Talk Python newbie.

01:35 It was great to have you on the show before, Will.

01:38 And we talked about Django then, and I suspect it won't surprise people with you and Carlton here

01:43 that we may touch on Django.

01:45 I think we've got to talk about Django a little bit.

01:47 A little bit.

01:47 Carlton, tell people who you are.

01:49 I'm a Django fellow, so what that means is I help to maintain the framework.

01:53 A framework the size of, oh, you've got me on Twitter there.

01:55 Oh, yeah.

01:56 Carlton Gibson on Twitter and on GitHub, numerous other places probably.

02:00 But a framework the size of Django's, it just simply doesn't get maintained

02:04 on purely volunteer effort.

02:06 So, there's a body called the Django Software Foundation, which Will's on the board for.

02:09 He can tell you a bit about that in a second.

02:11 But they are a charitable foundation, which, well, they collect money from donations from GitHub sponsors,

02:17 and you can donate on DjangoProject.com.

02:19 And then the main thing they do is they contract the fellows, which is myself and Maris Feliciak, who's my colleague now.

02:25 And we do that.

02:26 I don't know.

02:27 What do we do?

02:28 We triage the tickets.

02:29 We do pull request review.

02:30 We do handle security issues.

02:32 We handle the releases, not least the alpha releases today.

02:35 So, today, literally today, we released Django 3.2 Alpha 1.

02:39 Fantastic.

02:39 Is that the very first 3.2 release?

02:41 That's the first one.

02:42 So, that's like if you've got a Django project and you've got CI, you download it now and you run it on your CI

02:47 and you tell us all the things we broke.

02:49 Better before we release the final.

02:50 You know, it's much better during the alpha pre-release period than, you know, just after 3.2 final, you go,

02:56 hey, everything's broken.

02:57 Yeah, you really need people to test it now before it's too late, right?

03:01 Yeah, but yes, it's quite exciting because the last couple of weeks have been building

03:04 towards the feature-free.

03:05 So, the alpha marks the feature-free.

03:07 So, over the pre-release period now, we'll merge bug fixes in the new features.

03:12 So, anything that people find and report will fix and get out before the final.

03:16 But there's no new features going into 3.2.

03:19 So, on Thursday, just gone, I branched the stable branch for 3.2, which will be, that's Django 3.2.

03:25 And it will be that for the next three years because the long-term release gets quite,

03:29 the long-term support release, which 3.2 is, gets three years of support.

03:33 That's really great.

03:34 All right, we're going to definitely have to come back to that, but also, welcome, Will.

03:37 Tell everyone about yourself.

03:39 Real briefly, you know, you were on the show a while ago and we talked, I believe it was learning Django

03:43 we spoke about, right?

03:44 I've been involved in Django, it's the time.

03:46 So, I'd written, I think, a couple books.

03:48 So, I have three books, Django for Professionals and APIs.

03:52 And the last two years, I've been a member of the Django Software Foundation board.

03:55 About two people who were voted in, who play a prominent role in the community one way or another.

04:00 And then the board is seven people annually voted on who managed Django itself, which is a non-profit.

04:05 About that later.

04:06 So, yeah.

04:08 And I have now a website, learndjango.com, which is an online version of additional content.

04:12 But in addition to having a podcast with Carlton, Django Chat, since he's a fellow, which is contracted by the board,

04:19 we have another touchpoint, as if we didn't need more.

04:22 Exactly, yeah.

04:23 So, I was on your show a while ago and that was super fun.

04:26 I really enjoyed our conversation there.

04:28 And, you know, maybe just tell people quickly about your podcast.

04:32 What kind of stuff do you cover there?

04:33 Obviously Django, but, you know, where do they find it?

04:35 What do they cover?

04:36 Okay, so we get people on from the community.

04:38 It's kind of an interview type basis.

04:40 We get someone on.

04:41 It's fortnightly now.

04:42 We were doing it every week, but, you know, not like you, Michael, we can't keep it up forever.

04:47 So, we've gone fortnightly, which has taken a bit of pressure off with COVID

04:50 and, you know, the kids off school and all of that.

04:52 But we get, you know, people who've contributed to Django or people who are using Django in their business and talk about it.

04:58 So, it's Django Chat.

04:59 It's chatting about Django.

05:01 It's chatting about Django, yeah.

05:01 Yeah, yeah, yeah.

05:03 It's chatjango.com.

05:04 I think recreating a little bit of what you would have at a Django event.

05:07 So, these are annual events.

05:08 So, we started after I went to my first DjangoCon and met Carlton and was like, why can't I talk to people about Django more often?

05:15 And at the time, there wasn't a Django podcast.

05:17 So, yeah, we've gotten to interview really my dream list of guests.

05:21 I mean, we had...

05:22 Actually, I was just talking to someone else who works at Stripe, which is still running on Sinatra, which is a Ruby thing.

05:27 And I was like, yeah, yeah.

05:28 I've talked to DHH because he's came on our shows.

05:31 We talked about Rails versus Django.

05:32 We had Carl Meyer on, who's at Instagram, was formerly DjangoCore.

05:36 All the...

05:37 Basically, everyone...

05:37 Almost everyone we'd want to talk to who's involved in Django is willing to come on and

05:41 share their story.

05:41 So, I think it's a really nice connector and educational for us, too.

05:45 I do as well.

05:45 And you're just sort of a sidebar for our show here.

05:48 Being all of us fellow podcasters, I think it's really interesting the role that podcasts

05:54 play in keeping connections to the broader tech community when we can't go anywhere.

05:59 I mean, even if you weren't typically going to conferences or meetups, you could still go

06:04 to work and see other people, right?

06:06 It's just first when COVID hit, I was like, I'm just...

06:10 I'm not traveling anywhere.

06:11 I'm not taking my kid to school or anything like that.

06:13 So, there's no natural place.

06:15 Here, I'm stuck for 45 minutes.

06:17 I'm going to just listen.

06:18 But as it's drawn on, I've started to listen to shows, especially with multiple people trying

06:22 to bring sort of a normalcy.

06:25 And I get to kind of hang out with these people, even though they don't respond to me.

06:28 I still get to hang out with them.

06:29 And I think that's a really interesting societal thing that's happening right now.

06:33 Yeah.

06:33 I think it's beneficial across the board.

06:35 I mean, probably like you all, I listen to podcasts outside of tech as well.

06:39 And it's sort of like people I'd want to sit in on their conversations anyways.

06:43 So, for me, it's probably my primary media consumption aside from books.

06:47 Yeah.

06:48 But I mean, I'm not reading ancient Greek like Carlton.

06:49 Carlton has a PhD and all that.

06:51 We're going to talk about specifically deployments on Django.

06:55 I mean, we can go on and on about obviously all the intricacies of Django.

06:58 But I think suffice to say, I'm an educator and on the board and Carlton's a fellow.

07:02 So, he makes the releases happen, including 3.2 Alpha, which just dropped today.

07:06 And I guess you mentioned LTS.

07:08 So, that's confusing to non-Django people.

07:10 So, since having fellows like Carlton, Django has a pretty rapid release cycle where it's

07:15 every nine months or so.

07:17 So, there was 3.0, 3.1, 3.2.

07:19 This December, I think Carlton is 4.0.

07:21 One of those is a long-term service release.

07:25 So, that'll last two and a half years.

07:27 So, if that is a three years.

07:29 Yeah, it's on.

07:30 There's a link on the Django project site.

07:32 So, that's a way that.

07:33 So, Django doesn't really have.

07:34 It's rare to have breaking changes these days.

07:36 But the LTS is designed to help people who can't keep up with that cycle stay up to date.

07:41 Though we have a lot of podcasts and opinions about why you should always stay up to date.

07:44 And it's worth it.

07:45 Yeah.

07:45 Because that's one of the most rare things you can do.

07:48 Because as Carlton mentioned, there's bug fixes constantly.

07:51 So, there's 3.1.1, 3.1.2.

07:53 There'll be 3.2.

07:54 Then there'll be 3.2.1 a month later or so.

07:57 I'm a big advocate of, you know, if you possibly can get on the latest major release.

08:01 So, hanging out historically, the long-term release was really important.

08:05 The LTS release was really important.

08:06 Because there were breaking changes, right?

08:09 In each major version of Django, there were new things.

08:11 And it was difficult to keep.

08:12 But that's not the case anymore.

08:14 It's really easy to update.

08:15 So, I'm a big advocate of that.

08:17 Now, and then when I, you know, I talk to fellow people in the Django community,

08:20 they're like, well, you know, I work in the real world.

08:22 And you can't always keep up on the latest major version.

08:25 So, for those folks, then, you know, the LTS is a really good option.

08:29 Because it's once every three years.

08:31 You know it's coming.

08:31 Yeah.

08:32 You get a six-month window of overlap of support.

08:34 So, the old LTS gets six months of security release after the release of the new LTS.

08:40 And that's your window to update.

08:41 Well, I think that running and maintaining software built upon frameworks like Django,

08:46 it falls into two categories for me.

08:48 It falls into, here's something that we have a team or at least somebody dedicated to owning

08:53 this project.

08:54 And we care about its ongoing life.

08:56 And then we have the ones that are the, oh, please don't touch it.

09:00 And the, oh, please don't touch it is we've long since stopped developing that.

09:04 Maybe the person who developed it left.

09:06 But it's still important.

09:08 And we don't want to break it.

09:09 It's working right now.

09:11 But if you touch it and you break it, you've now adopted it.

09:13 You know what I mean?

09:14 Like, it's that thing that just, it runs.

09:17 It's like if you break the build.

09:18 Yes, but, but worse because it's legacy build.

09:21 So, to me, I feel like that please don't touch it side, the LTS make perfect sense for them.

09:26 Yeah, entirely, entirely.

09:27 The way I like to think of it is, is this a thing that you're feasibly going to add new

09:32 features to?

09:33 And if you're feasibly going to add new features to, then you should be on the latest major

09:36 version.

09:37 And because it's only, it's once every eight months, you need to allocate a day or two to

09:41 keep up, to, you know, fix up, download the new version, run the test suite, see the

09:45 deprecation warnings, fix the deprecation warnings.

09:48 You know, maybe you have to wait a couple of weeks for a dependency to update and, and

09:52 then you can push forward.

09:53 And that's once every eight months, that process.

09:55 And if you're adding new features, if it's a live project, ideally you'd be there.

09:59 There's something which you just need to keep running for the long run.

10:01 You know, you could do that much less frequently.

10:04 Right.

10:04 But it allows people who have that, please don't touch it.

10:07 But, oh, there's a security problem.

10:09 If there's no LTS and there's a security problem, then not only do they have to figure out how to

10:13 redeploy the fix, they've got to say, well, we didn't touch it for three years and it doesn't

10:18 quite work the same.

10:19 So then you get into the discussion of, well, what's the risk?

10:23 Will they really, it's just Java swing.

10:25 I mean, come on, what's the problem, right?

10:27 How bad could that go with, you know, like the entire world's credit report speed?

10:32 Now that we're in Python 3 world, Django was part of that.

10:35 It's really beyond the security thing.

10:37 It's also all the ecosystem around Django, the third party packages.

10:40 Like a lot of times, if you look at their project that says, I can't update, why can't you update?

10:45 They did two things.

10:46 They're using a third package, which falls into that, you know, touch it, you broke it situation.

10:52 Or they did something custom at one point.

10:54 They went off the guardrails and the bill comes due.

10:58 I mean, it's so tempting.

10:59 Actually, I want to, speaking of going off the guardrails, quick note that Django just passed

11:04 Flask to have stars, which is a really poor metric of popularity, but nonetheless, we'll take it.

11:09 Yeah, congratulations.

11:10 That's awesome.

11:11 It's very easy to, you know, spin up a couple API endpoints and boom, you're using Flask.

11:16 That's a very different thing.

11:17 That's like, as DHH would say, that's a Lego versus the Lego truck that is a framework like Django.

11:22 And anecdotally, a lot of places use Flask, but in terms of a big site that's all Flask, that's much less common than all Django.

11:31 Yeah.

11:31 Well, I was thinking about this morning and it, you know, the Flask and Django are pretty neck and neck in terms of popularity.

11:38 They're not on GitHub.

11:40 Yeah, yeah, sure.

11:40 There's these metrics and popularity.

11:43 They, there's like all over the map.

11:44 So one of the thoughts I had though, is the people that use Flask, this is not a knock against Flask.

11:49 I like it.

11:50 But one of the, my sort of impressions is if I just need to, like you said, just create a couple APIs and just, we're just going to get something going real small and simple.

11:57 And it's just roll.

11:58 Like those people are not as invested in the ecosystem and the framework as I feel like the Django folks are.

12:06 I feel like the Django folks, it's a more encompassing part of their development.

12:10 Like Django feels more part of the project when people adopt it and love it.

12:17 I don't know.

12:18 What do you guys think about that?

12:18 You need a dozen apps to use Flask.

12:21 And I hope that we get David Lord on to talk about Flask because he's at Django Cons.

12:24 I mean, it's not a competition.

12:25 I don't mean to say there's a competition between the two, but there are different purposes, I would say, Carlton, right?

12:30 Yeah.

12:31 The different styles as well.

12:32 Like, you know, if you want to put together something, why not Flask?

12:35 But I mean, I've been using Django for so long now that even if I just need to spin up two endpoints, it's much quicker for me to do that in Django than it is to go and get a supposedly micro framework and work out how am I supposed to use this?

12:48 We can put the link in the notes.

12:49 I made up a repo with the code because you didn't provide code.

12:53 You can have a single file Django project the same way you can for Flask because a lot of times that whole little world comparison will lead people to assume that Flask is much less complicated than Django.

13:04 And it's a little bit less.

13:05 It's more around to how it's structured, which is the point of Carlton's talk.

13:08 Yeah. So the talk was called How to Use Django as a Micro Framework or something like that.

13:12 And it was about the base HTTP handlers, the kind of that real core of the framework.

13:17 And I put up a few examples from different frameworks, like Flask and an old example and Starlet, the async micro framework from Tom Christie.

13:26 And then I showed how you might put that together in Django.

13:30 Yeah. For people who don't necessarily live and breathe the web stuff like the three of us do.

13:34 Yeah.

13:34 Give them a quick definition of micro framework before you go on.

13:37 Well, in the talk, I was like, you know, what is a micro framework?

13:40 Yeah. I'm asking you because I don't want to put my foot out there.

13:42 The answer I came up with was it's got a great hello world, right?

13:46 Yeah. Okay. Sure.

13:47 I think the idea is that it's easier to contrast it with like Rails or Django.

13:52 Rails and Django, they come with the batteries included with everything you need.

13:55 You know, you've got your ORM or active record.

13:58 You've got an ORM, you've got database, you've got migrations, all that stuff.

14:02 Yeah. You've got all those stuff.

14:04 Whereas your micro framework, you perhaps get the core HTTP handling and that's about it.

14:08 And then you have to go and find a forms library.

14:10 Okay. I found a forms library.

14:11 And then you have to pull in an ORM or a database of that.

14:14 Okay. I'll use that.

14:15 And, you know, so there are Node full batteries included frameworks.

14:20 Like Happy is very good.

14:21 It's got everything you need.

14:22 But like the classic Node example is, oh, you know, I get Express and I pull in this thing for passing URLs and that thing.

14:29 You know, so there's a continuum.

14:31 But micro frameworks fit more towards that.

14:33 You know, you put the pieces together yourself.

14:35 Whereas a batteries included framework like Django, you get not everything but a lot in the box.

14:40 Right.

14:41 Right. But your experience is more Django pieces, Django building blocks than a little flask, a little SQLAlchemy, a little this, a little that.

14:47 Definitely. And I've been doing it so long now that I'd struggle to break out of that.

14:52 I just, you know, I throw in a bit of Starlette or a bit of FastAPI, see what's going on with the new frameworks.

14:57 Every new framework that comes out, I'll always give it a run.

14:59 And then my question is, okay, well, what can we learn from that?

15:02 This portion of Talk Python to Me is brought to you by Square.

15:07 Do you run or want to build a web application that sells products or services?

15:11 Building a successful online business is the stuff that dreams are made of.

15:14 But accepting payments and handling credit cards with all the various regulations is a common stumbling block.

15:20 But not with Square's payment API.

15:22 With Square, your Python web app can easily take payments.

15:25 You'll seamlessly be able to accept debit and credit cards as well as Square gift cards.

15:29 Let your users pay with their digital wallets.

15:32 Square works with Apple Pay, Google Pay, and MasterPass all in one go.

15:36 Your API includes PCI compliance, end-to-end encryption, dispute management, and fraud detection.

15:42 Build your online payment form in three steps with Square payment SDKs.

15:46 Step one, create a new Square API application.

15:49 Step two, add Square's payment form to your checkout flow.

15:52 Step three, use Square's API to charge the card.

15:55 So get started building your business on Square.

15:57 Just visit talkpython.fm/square or click the link in your podcast player's show notes.

16:02 That's talkpython.fm/square.

16:06 A really large site.

16:08 If you ask them what language and framework do you use, it's like everything.

16:11 Just because of the needs of a massive site, it ends up being...

16:15 It's hard to say that it's truly one thing.

16:16 I mean, Instagram still has pieces of Django in it.

16:19 But at that scale, it's its own thing.

16:21 And I think the micro frameworks are really good for doing that.

16:24 This might be a pessimistic take, but I've heard people make that a micro framework allows you to switch the complexity from individual developers who may be sharing you just as much up to your upper level because they only can touch a tiny part of the monolith.

16:38 So they can, in a way, do less damage.

16:40 That's actually an organizational argument for micro frameworks is that only the software architects or the senior people fit it all together.

16:46 They weave the pieces or they build the puzzle or whatever.

16:49 That, I guess, especially if you're testing suite isn't as good as it could be.

16:52 Yeah.

16:53 I don't know.

16:53 I think there's an interesting conversation about like monolith type software styles versus not.

16:58 I'm actually a big fan of the monolith style.

17:00 All my attempts to break it into little pieces, at least in the microservices, which is not the same as micro framework, but I always feel like I've quadrupled my deployment complexity to half my software complexity.

17:11 And I'd rather manage half as much software complexity as twice as much deployment complexity.

17:16 Like if you were part of a five person team in a large organization assigned to fix something and you're just like, there's no way we can get done within this monolith.

17:23 But like, oh, we could spin something up and solve the problem and move on.

17:27 I play that by a lot.

17:28 I think, you know, or an individual project, you get fancy and you customize Django or you use a third party package that is out of date or maybe you shouldn't use any of the same issue.

17:38 Yeah, I don't know.

17:38 Like, OK, we're segwaying slightly back into the deployment topic, which ostensibly we came to talk about.

17:44 But I think the thing with microservices, right?

17:47 So if you've got a massive corporation, you can't have all the things going on in one team.

17:52 So you need to segment it somehow.

17:54 And then you can define service boundaries and it starts to make sense.

17:57 Then all the tech blogs become about microservices and how this is the way.

18:02 And then learners come along and they're like, well, I've got to build my thing using microservices.

18:06 It's like, no, that's really not a good move.

18:09 But where are the blog posts?

18:11 Not for, you know, and now the pendulum swings back.

18:14 And, you know, there are lots of posts now about how monoliths are making return and how they're the way to go.

18:20 And so hopefully the beginners come and see those posts.

18:22 But when you're learning and everyone's saying, oh, you must use a microservice architecture.

18:27 It's like, hang on.

18:28 Yeah, because the people who are knowledgeable are writing about their day job.

18:31 They're not writing about spinning up a Django app on a weekend, which is possible.

18:35 And you can deploy it, too, which we could.

18:37 Should we get into that deployment?

18:39 I do want to just point out, I think this might be the article that I read before.

18:43 Like the, yeah, you're not Google.

18:45 You're not LinkedIn.

18:46 You're not Facebook.

18:46 You're not Netflix.

18:48 There are people who actually that's an inaccurate statement about.

18:51 There's plenty of people that work at those companies.

18:53 But like you said, Carlton, the people who come along, they see these companies who they respect and say they must be doing it right.

19:00 And so often with these deployment stories, with these design patterns, you know, should you have like separate caching servers that run like something like Redis?

19:09 Yes, you should.

19:09 No, you shouldn't.

19:10 And that's the right answer at the same time.

19:12 But with the context that you need, right?

19:14 Are you trying to run 10,000 servers and let 500 people work on this project?

19:19 Or are you two people trying to do a startup?

19:21 Like those are not the same tradeoffs and balances you want to make, right?

19:25 Yeah.

19:25 And it depends as well on your model.

19:27 So one example that I really like is Stack Overflow.

19:29 Now they're built entirely on the Microsoft stack.

19:32 So they've got SQL Server and they're using .NET.

19:34 But the basic point is they've got a really big database one and then, you know, a few worker processes in front of those.

19:41 And that's it.

19:42 It's a classic monolith.

19:44 And they're one of the biggest sites on the internet.

19:46 And yet they're incredibly fast.

19:47 Yeah, exactly.

19:48 As fast as you could ever want.

19:49 Okay.

19:50 They do it in this kind of monolith, old school style, you know, vertical scale.

19:55 Make it just bigger.

19:55 Don't spin out parallels.

19:57 Just make the thing bigger.

19:59 Buy a bigger database server.

20:01 So that's, you're not going to be bigger than Stack Overflow, right?

20:04 Right.

20:04 And then another example we have.

20:05 And when you are, you'll reevaluate it anyway.

20:07 Whatever you do now is not going to solve that problem.

20:09 Yeah.

20:10 But you're not going to be bigger than Stack Overflow.

20:11 And then we had another example, which was Dr. On Demand.

20:14 They came on, Matt Lehman from Dr. On Demand came on Django Chat recently.

20:17 They've got a more containerized approach to it.

20:21 But the thing is, they're doing peer-to-peer communication between, you know, many simultaneous peer-to-peer video communications.

20:28 Because Dr. On Demand is like a telemedicine, right?

20:30 Right, right.

20:31 Like, I need to book a video appointment with my doctor.

20:35 Yeah, exactly.

20:35 And so, but they've got so many of those processes needed to be spun up that they need something which scales out and then back down again very easily.

20:44 So they've got a kind of more, like, modern, more, a cooler technology.

20:48 They're not as big as Stack Overflow probably in terms of raw traffic.

20:51 But they need that flexibility of architecture.

20:53 That's what we always think about, right?

20:54 We say, it depends.

20:55 That's our timeline.

20:56 Yeah, it depends.

20:57 It depends.

20:57 Yeah.

20:58 Exactly.

20:59 That's your subtitle.

21:00 I do think the context, right?

21:02 When people talk about design patterns, deployment, architecture, those are always within a silent, not mentioned most of the time context in which that makes sense.

21:12 And you've got to decide, are you in that context or are you not?

21:14 Yeah, no, entirely.

21:15 I should say, what problems are you trying to solve?

21:16 Like, you can't innovate everywhere.

21:18 Like, there's so many pieces to a website.

21:20 Do you want to innovate on deployment?

21:22 Not until you're, you know, Instagram, I don't think.

21:24 No, well, I think that's a great point.

21:26 And it's when you're small, the most important thing is adding features and going quick, right?

21:31 When you get bigger, the most important thing is to not go down, right?

21:34 If random little project that is like an ordering service for a restaurant in Milwaukee, if it goes down for half an hour, it's not ideal, but it's not the end of the world.

21:45 If Google goes down for half an hour, people really notice.

21:48 You know, it's like front page news type.

21:49 So it's just a totally different thing.

21:51 Now, before we move on to more deployment stuff, and we're kind of in there, I do, before we get away too far, maybe we could touch real quickly on some of the new features that are coming in 3.2 and like the Django 3 stuff that you guys are excited about.

22:03 Yeah, maybe can you start with just 3 in general, Carlton?

22:06 Because I think that makes 3.2 have more context.

22:08 Well, okay.

22:09 So, but 3 introduced, 3 began the process for making Django async, right?

22:14 So we added, so historically, Python has this WSGI, the web service gateway interface.

22:20 So Django is a WSGI framework.

22:21 Flask is a WSGI framework.

22:23 It was this standard so that application servers could talk to protocol servers, which could talk to the internet without, you know, each framework having to have its own protocol server.

22:32 So Gunnicorn is a WSGI server, and it can speak to Flask, and it can speak to Django, and it can speak to any other WSGI server.

22:39 Right.

22:39 You can use that, and I can use micro WSGI, and it's, we don't have to coordinate or do anything.

22:45 It just happens.

22:46 That's because of the WSGI or WSGI thing, right?

22:49 Yeah.

22:49 So that's the standard.

22:50 And so in order to make things async, there's this thing called ASCII, which is the asynchronous gateway interface.

22:57 I don't know.

22:58 Yeah, I don't know.

22:58 I don't really, yeah.

22:59 Anyway, it's not WSGI, it's ASCII.

23:01 So first of all, Django 3.0 brought in an ASCII handler.

23:05 So it wasn't async at all, but you could run it under an ASCII server.

23:09 And then 3.1 brought in actual async views.

23:12 And you can define an async def view, and you can use, I don't know, HTTPX, which is like an asynchronous HTTP client with a request.

23:21 Yeah, it's like requests, but async.

23:23 Right.

23:23 Or what's the ORM story?

23:25 Does that support async at await yet?

23:27 Right.

23:27 No.

23:27 So that's not there yet.

23:29 So this is something that will develop probably over the course of the Django 4 lifestyle.

23:33 So there's plans and there's thoughts.

23:36 And we need to get to the point where you, with the ORM, where you can, down to your kind of filter call.

23:43 And so things like filter, they can be totally synchronous because they don't actually do any IO.

23:47 They don't actually hit the database.

23:49 But when you then go, right, I've got my query set and I'm going to iterate it and I'm going to fetch the objects from the database.

23:55 We need that bit.

23:56 Even if the actual connection is run in a thread or whatever, we need that bit to be fully async.

24:01 And then Django will feel async as it is.

24:05 At the moment, if you write an async for you in Django, you kind of have to say, well, I'm not going to touch the DB.

24:09 I'm not going to.

24:10 Yeah.

24:11 You can wrap the ORM in async to async wrapper, but you kind of lose the point of that.

24:17 Yeah.

24:17 Yeah.

24:17 But that's coming, right?

24:18 Yeah.

24:18 So Andrew, yeah.

24:19 So Andrew Godwin, who's driving this effort, he gave a talk at DjangoCon Europe about the structuring of this and what it's going to look like.

24:27 And it's like, yeah, that makes sense.

24:29 This is going to work.

24:29 And we don't have to get, what's nice is we don't have to get async all the way down to the very bottom because we can run the actual, we can sort of hand off the actual database connection in a thread executor.

24:40 But from the outside of the ORM, it will look async.

24:43 And then you can, you know, you can stream out your content records of maximum throughput as you want to, that kind of thing.

24:50 Yeah.

24:50 Well, the fact that you can already do external APIs.

24:53 And if you're going down the microservice path, you can do your microservice calls with HTTPX and await those.

24:58 That's already a huge step.

24:59 Yeah.

24:59 Yeah.

25:00 So without, and this works, what's amazing about the way Andrew is just absolute hero, but he put it together in such a way that you can run this with a WSGI service.

25:10 You're running Django 3.1 with GunnerCorn.

25:13 Like you always have.

25:14 Yeah.

25:14 And you think to yourself, I just need to make a couple of API calls, but they're quite slow and I want to make them in parallel.

25:19 You can do that just by writing an async def call and then, you know, making the parallel calls using HTTPX.

25:26 And it just works.

25:28 And Django does all the rest for you and adapts it.

25:30 And you didn't have to change your application server.

25:32 You didn't have to do, you know, it's just like, yeah, we've got async just there.

25:35 One of the challenges if you're talking to the database is you say, okay, fine.

25:39 The bottleneck was we are waiting at the web server level, at the Django level.

25:44 And then we're going to push that down to the database.

25:46 We're going to just make all that async.

25:48 All of a sudden, all the pressure is now on the database, which can be a problem.

25:52 But if you're talking external APIs, you're now pushing the pressure onto the internet, which is way scalable.

25:57 Yeah.

25:57 And it's always going to scale more than you, right?

26:00 You're not going to need that many client requests probably.

26:02 Yeah.

26:03 Also, David Smith out there says 3.2 will be a great release.

26:06 You guys have done a great job getting many patches over.

26:08 Yeah, for sure.

26:09 Thank you, David.

26:10 Super.

26:11 We were working really hard.

26:13 We had two longer lists and we got, you know, one we had to bump for Django 4.0, but the rest we got in.

26:19 So we were very good.

26:19 Okay, so 3.0, acing it away.

26:21 This is a big deal.

26:22 Yeah.

26:23 And so those are the big features for 3.0.

26:25 And then what's coming in 3.2, we've got various other bits and bobs.

26:29 You can customize primary keys.

26:31 So traditionally, they've just been autofield, which is in 32.

26:34 Well, eventually, you know, if you get 22 billion of those or something, you can run out.

26:38 So you can now customize that for big in.

26:41 And over the next couple of releases, you know, major releases, we will make the default big in because that's probably what it should be in 64.

26:48 Because then you're never going to run out of primary keys.

26:50 But that's something that big sites run into that, especially if you start creating, I don't know, events, an event log.

26:57 Yeah.

26:57 You know, a site can generate a lot of events and they can add up quickly.

27:01 You know, so.

27:02 Yeah, they definitely can.

27:03 Functional indexes in the ORM.

27:05 So you can create an index on an expression like that these were greater than or that the sum of this was.

27:11 And then you can query on those at full speed because they're indexed.

27:15 That's a really big feature.

27:16 Oh, really?

27:17 So you can do a query like the sum of the orders of this.

27:20 The customer is greater than $100.

27:22 Yeah.

27:22 And that's a relationship.

27:23 Yeah.

27:23 And then you can create an index on that value.

27:25 And you've been able to do that in raw SQL for, you know, any amount of time.

27:29 But that's now exposed at the ORM level.

27:32 And that's nice.

27:33 That's awesome.

27:33 You can just kind of.

27:34 Yeah.

27:34 For people who are doing reporting or that kind of thing.

27:37 Yeah.

27:37 That's massive.

27:38 This portion of Talk Python to me is sponsored by Linode.

27:43 Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines.

27:48 Develop, deploy, and scale your modern applications faster and easier.

27:52 Whether you're developing a personal project or managing large workloads, you deserve simple, affordable, and accessible cloud computing solutions.

28:00 As listeners of Talk Python to me, you'll get a $100 free credit.

28:03 You can find all the details at talkpython.fm/Linode.

28:08 Linode has data centers around the world with the same simple and consistent pricing regardless of location.

28:13 Just choose the data center that's nearest to your users.

28:16 You'll also receive 24-7, 365 human support with no tiers or handoffs regardless of your plan size.

28:23 You can choose shared and dedicated compute instances, or you can use your $100 in credit on S3 compatible object storage,

28:30 managed Kubernetes clusters, and more.

28:33 If it runs on Linux, it runs on Linode.

28:36 Visit talkpython.fm/Linode or click the link in your show notes, then click that create free account button to get started.

28:45 And then we've got, I don't know, a new memcache backend for the cache.

28:48 We've got, you know, updating the API for using the admin for nice decorator API for creating various admin customizations.

28:56 We've got themes in the admin.

28:57 We're going to ship a dark thing.

28:59 It's a big one for people to see right away.

29:01 Because the Django admin could use a refresh and there's been all sorts of third-party ways to customize it,

29:07 but now be built in a bit more.

29:08 There's all sorts.

29:09 In the blog post for the author, I described it as a mess of new features.

29:13 And that's exactly what it is.

29:14 But what's nice is it's not, there aren't, apart from async, which is coming,

29:18 there aren't any new major features in Django, right?

29:21 It's 15 years old.

29:22 It's rich and mature and largely feature complete.

29:25 But each major release, each eight months, it always amazes me when we're drawing to get up the final release notes,

29:32 how much depth and extra, like, substance there is in the features that we've managed to add

29:38 and that have been contributed over that eight-month period.

29:40 Yeah, that's fantastic.

29:41 So I feel like you're capturing much of the modern Python awesomeness.

29:45 One other area that's, I think, interesting.

29:48 I have no idea what your plans are around it, but maybe you could just give us your thoughts, is type hints, type annotations.

29:54 Yep.

29:54 That's difficult for us.

29:57 Carl, about that a little bit.

29:58 Yeah, I mean, that's difficult for us because Django, I mean, if you take the awesomeness,

30:02 it's super dynamic.

30:03 And there's an amazing project, Django Stubs, where they've got stub files and they've got,

30:08 you know, they've done a super job.

30:09 And it really does work well.

30:11 So if you load up VS Code or PyCharm these days, you get very good autocomplete around things like Django model field definitions.

30:19 Yeah.

30:19 And that's all powered by Django Stubs.

30:22 Yeah.

30:23 Which probably is powered by type hints underneath, right?

30:25 Yeah, yeah.

30:26 It totally is.

30:26 A year or so ago, there was some discussion about whether we would make those inline hints

30:30 in Django itself.

30:31 And the technical board at the time said, no, we need the typing technology to evolve a little bit further in Python itself before Django can

30:39 jump on and say, look, we endorse this particular technology.

30:42 There is, there's various ways of doing it and various type hinting, type checkers and various.

30:47 And so, so we, we favored mypy, which is obviously the endorsed one.

30:51 Well, what about the others?

30:52 We can't support them all and they might change and-

30:55 PyWrite and all the different various initiatives.

30:57 Yeah.

30:57 We can't take it out once it's in.

30:59 The thing with, the reason why people love Django is because it's super stable.

31:02 You know, you write a site five years later, you don't really have to do very much to keep

31:06 it going.

31:06 And so the technical board at the time said, no, we're not going to bring those type hints

31:11 into Django, but that will be reviewed.

31:13 You know, we'll look at it again in a little while's time.

31:16 One thing I will say about typing in all the peps, it says type hints remain optional.

31:21 They're not meant to be compulsory, even by convention.

31:23 Do you feel maintaining Django a certain pressure to have them?

31:27 I do worry that that optionality of type hints is perhaps undermined a little bit in the day

31:33 to day development.

31:34 I'm not sure.

31:35 I also code in Swift, right?

31:37 Which is a fully statically typed.

31:38 Swift is pretty strong in its syntax.

31:41 Like you can't even null out.

31:42 Yeah.

31:43 Even if they could be, right?

31:44 If there's not allowed to be optional, explicit, there's a lot of interesting stuff happening

31:48 in the Swift type.

31:49 Yeah.

31:49 I mean, Swift is a fantastic language, but there's no option.

31:52 It's type hints or it's type annotations all the way.

31:56 And then when I come back to Python after a few hours of that, I'm like, oh, this is so

31:59 breath of fresh air.

32:00 You know, the thing that I really, the comparison that I make a lot is between TypeScript, which

32:05 is type annotations for JavaScript and Python type hints.

32:09 And I always walk away from TypeScript feeling like, ah, that was way harder than it should

32:14 have been.

32:14 Why was it so frustrating and fighting me?

32:16 Whereas in Python, you might get some squigglies because you didn't quite define something just

32:20 right or it wasn't defined at all.

32:22 But then it just, it carries on, right?

32:23 Whereas things that are completely, it must work within this context.

32:28 They can become challenging, especially the reason I bring up TypeScript is the stuff that

32:33 it brings in is not necessarily typed, just like Python.

32:35 Whereas Swift is end to end.

32:37 It's all from scratch under that same system.

32:39 So it's coherent.

32:40 But bringing in, say, jQuery into TypeScript, like there's no TypeScript jQuery.

32:44 I know there's like stubs you can put on and whatnot, but like that kind of stuff is more

32:48 Python-like.

32:49 And so I think it's pretty interesting.

32:51 Yeah.

32:51 And Django's in that very much in that boat where it was never written with type hints in

32:55 mind.

32:55 Yeah, of course they didn't exist.

32:57 And if you look at Django stubs, it's awesome.

32:59 But a lot of the things are like string or any.

33:02 And it's like, that's horrible, right?

33:04 You don't want to write that every single time.

33:07 That's an issue.

33:07 And then another thing I see, which I'm not sure about, sometimes they make a type like

33:11 a model, the Django model admin, they make it a generic that takes the model type, which

33:16 tells you what it's the admin of.

33:18 And I remember, and I look at that and I wince a little bit.

33:20 You're like back to C++ templates or something, right?

33:23 Yeah, yeah, yeah.

33:23 And I see where they're going with that.

33:25 It's amazing what they've been able to do there.

33:27 But I remember coding Objective-C UI Table View, say.

33:30 And what you would always do is you get object, your row class in from the UI Table View delegate

33:36 where you're getting a list of cells, right?

33:37 So like a list of email messages.

33:39 And you'd immediately cast it to the type you wanted so that you knew what you were dealing

33:43 with.

33:44 Yeah.

33:44 In a way, when I get something back from a model admin, I'm quite happy to write colon

33:48 model name.

33:49 Yeah.

33:50 To tell the editor what it's meant to be.

33:52 To tell the type checker what it's meant to be.

33:54 And then for the rest of the method, I get the autocomplete.

33:57 I get the type checking.

33:58 And you probably don't put any more type hints because it's just now flows.

34:01 And it's, I agree.

34:02 It's so good at generating, like allowing you to generate code incredibly fast if the tool

34:06 supports it.

34:07 One quick comment or thought that before we move on, this having types around the ORM

34:13 is really interesting because all the big ORMs seem to do the same basic flow.

34:17 You know, I'm thinking, you know, Django ORM, SQLAlchemy, even NoSQL ones like Mongo Engine,

34:22 which I use.

34:23 They all have a class which has the columns defined as descriptors.

34:27 So at definition time, they create the tables or the collections.

34:31 And then at runtime, they become the scalar versions of the thing they say they are, right?

34:36 That an integer column is now actually an integer.

34:38 So what I've done when I define the model class is say like name colon str equals string

34:45 column.

34:45 And so the Python thinks it's all the types are actually what I said, the primary types like

34:51 in the model.

34:51 And then the underlying ORM can do what it needs to do.

34:55 But, you know, the rest of my code is like, oh, that's a float column right there or float

34:59 field.

35:00 That's been really helpful.

35:01 I don't know.

35:01 I haven't run into any problems doing that, but it's been pretty helpful.

35:05 Yeah.

35:05 I mean, it's the thing that brings my talk.

35:07 Well, there's data classes, right?

35:09 Which they brought in in 3.7 or 3.8.

35:11 Yeah.

35:11 And then Pydantic is an exciting thing, which is...

35:14 Pydantic is fantastic.

35:15 Yeah.

35:16 You define a model, call it a model with exactly this.

35:19 It's like field name type with an annotation string or int or whatever.

35:24 And that works really well.

35:26 And I can imagine us generating Django ORM models from that kind of thing.

35:31 But then you end up needing options.

35:33 Like, is it nullable?

35:35 Or is it, you know, is it required?

35:37 Is it...

35:38 What validators does this field have?

35:39 And then it starts...

35:41 When you start to add validation, it starts to look almost like what we've got now.

35:45 I mean, Pydantic's got one good advantage in raw serialization speed.

35:48 It's very fast.

35:49 So that's something we can learn.

35:51 But the short answer is, I don't know.

35:53 But it's exciting times, isn't it?

35:54 It's very exciting times.

35:55 All right.

35:56 Let's talk really quickly about maintaining your content or things that you generate.

36:01 Like, you guys all write articles, books, do online stuff, even podcasts.

36:06 So 3.2 is out.

36:08 What broke?

36:08 Like, real quickly, Will, maybe you want to just talk about what you've been doing to...

36:12 Yeah, there's a reason why there's very up-to-date Django books, because the release cycle of every

36:18 nine months doesn't overlap with the traditional publisher cycle.

36:22 So for me, I mean, I'm on version, I think, five for most of the books.

36:26 So I was on 110 or 111.

36:28 So it's sort of like writing the book again.

36:31 Every time I basically go through from scratch, because all the code is linked to the text.

36:36 Because I'm self-published, I can do all that.

36:38 I have my flow down.

36:39 So really, I have a list of new features I know that are in there.

36:43 So I'll play around with them to make sure that things don't break.

36:45 And then I'm constantly emailing with readers.

36:48 So I have feedback on what works and what doesn't.

36:51 So half the new features are fixing things so it's smooth.

36:54 And then half just making the text.

36:56 So at this point, I feel pretty good about the flow of all three.

37:00 And people will say, what about this?

37:01 And maybe I can explain it a little bit better.

37:03 I added, I mean, so for a 3.1 added in the beginner's book, I really wanted to have proper

37:08 deployments, but not go as deep as I do in the professional's book.

37:12 So I did introduce environment variables and showed, I think, a pretty elegant way to get

37:17 environment variables and to have some lockdown for deployed site.

37:21 Whereas before in beginners, it was just sort of like the local version, which is pretty open,

37:26 was what you deployed because it was more about getting something up.

37:29 I was able to introduce environment variables.

37:31 We could talk about that more.

37:32 There's a third party package.

37:34 It's great.

37:34 So that's always the tension for me is showing and telling, right?

37:37 Like I want to explain everything, but I don't want to overwhelm people.

37:40 And so that's part of the thing I have to think about for 3.1.

37:43 And I think also for Django being so stable, at least you can say all the stuff is still

37:48 the same.

37:49 There's just new features we haven't mentioned or a new way maybe is better, but as opposed

37:53 to this does not work anymore.

37:54 Well, it's the difference between what trips the professional programmer and someone who's

37:58 new.

37:58 So for example, in 3.1, the pathlib was added when you create a new Django project, the settings.py

38:05 file, which is the default settings.

38:07 The way the routes are done is a little bit different.

38:09 Like a minute stack overflow thing for someone who's used to using Django.

38:13 or the breaking stuff, but that can completely derail a beginner.

38:16 There's usually a couple of things like that.

38:18 You know, so in that case, like I have a dedicated blog post because I knew that was coming.

38:22 And just this morning, I got more questions around it.

38:24 So it's that's sort of the thing that fun me is figuring out how do I, you know, be compassionate

38:29 to the true beginners, but we're more further along.

38:34 It's a lot of work to do.

38:35 I don't know how you could do it.

38:36 I don't either.

38:36 I was just dealing with some GitHub issues on some folks who are having trouble because a

38:41 mismatch of pip upgrades and other packages.

38:44 And it's just like, it's just how it goes.

38:46 Real quick, John from the live stream is really excited about the admin themes.

38:51 So that's really cool that that is going to come along.

38:53 Thanks, Sean.

38:54 They add up to greatness.

38:55 I think that's, I love that.

38:57 Yeah, that's a great, great say.

38:58 All right.

38:59 We talked a lot about deployment already, which is why I've been dancing around a bit.

39:02 But let's go ahead and talk about deployment.

39:04 So when I create a web application with Django or really honestly with Flask or anything, I've

39:10 got a cool app.

39:11 But it's, you know, web apps are not generally meant for the individual.

39:15 They are meant to go on the internet and be amazing and connect things and allow other people

39:19 to do stuff.

39:20 And that's a huge gap, right?

39:22 So maybe I've just learned how to do Django.

39:23 You just talked about your beginner's book, Will, and I finally got that one page that

39:28 wouldn't show.

39:29 And the database stopped, you know, crashing when I did that one query because I checked

39:32 for none now and it's all good.

39:34 Wait, I have to learn Linux and I have to become an admin and what the heck just happened, right?

39:38 So how do you guys approach that?

39:41 What do you tell that person?

39:42 Yeah.

39:43 First of all, hand on shoulder, I feel you because it's just there's this massive deployment

39:52 gap.

39:52 We've got the Django tutorial.

39:54 We've got the Django girls tutorial.

39:55 We've got the Django rest framework tutorial.

39:57 People have done those.

39:58 They've got their app together.

39:59 They've come up with some ideas.

40:00 They've learned a teeny bit of JavaScript to make it that bit better.

40:03 And now put it online.

40:04 And exactly this, I've got to learn Linux.

40:06 Oh my word.

40:08 Yeah.

40:08 Among other things.

40:09 I mean, it's two things though, right?

40:10 I think, I think like when I think about this, oh, there's, there's two ways to think

40:14 about it.

40:14 One is making it friendly, which we can talk about.

40:17 And then there's the specifics of, do I, you know, do I do it on a VPS?

40:21 Do I do it on a pass?

40:23 So there's two separate things.

40:24 The first one, I think we can generalize and Django has some good notes on that.

40:29 The second one is sort of a deep end of opinion.

40:32 I guess I'm in favor of like, I use, I'm a big fan of platforms.

40:36 If somebody had something that like hosted AWS for Django, I would use that.

40:40 I mean, so, and I'm just going to throw it in here now.

40:43 I'm working on a app for this exact problem.

40:45 It's called button.

40:47 It's btn.dev.

40:48 And it's the idea is to be able to spin up a small environment for this exact.

40:55 I just want to get my app on line use case without, you know, you're having to become

40:59 a sysadmin expert.

41:00 Yeah. So the spectrum looks like to me pass, right?

41:04 Platform as a service, which you said you like Heroku and there's other options as well.

41:08 Yeah. Heroku, DigitalOcean.

41:11 Then I think maybe button is even before that.

41:14 I'm not entirely sure.

41:14 Like in terms of complexity.

41:16 Let me jump in.

41:16 You've got the platform as a service.

41:18 You've got Heroku, which is there at one end.

41:19 And that's kind of like, they'll run your app, but they don't, that's it.

41:23 Right. Or, you know, you can run another worker instance, but then you say to yourself,

41:27 I want to, I just want to put a file online.

41:29 And it's like, well, how on earth do I do that?

41:30 I can't. Or I want to put up a static website.

41:32 So I've got to bring in, I know, Netlify because another service.

41:36 Yeah. Netlify is really nice for just pure static sites.

41:39 Actually.

41:40 Yeah.

41:40 It is. It's awesome.

41:41 But then all of a sudden you're running two services and then you want to do some log analysis.

41:45 So you've got to bring in and it's like, oh, hang on.

41:47 I've got three services now running and it's, it gets a bit out of hand.

41:51 So then on the other hand, you've got AWS and you go to AWS and it's like, oh my word.

41:56 You know, it's the paradox of choice.

41:58 It's just like that in Azure.

41:59 I mean, they're both incredibly powerful, but it's just like, oh my goodness.

42:03 Look at this admin dashboard.

42:04 Like I, there's huge thing with a 50 choices.

42:07 I go into one and it expands into 20 and then I need to figure out the right one of those 20.

42:11 It's just, it's mind boggling.

42:12 Yeah, exactly.

42:13 And so where button fits in that is it's on AWS, but it provides a very simplified environment.

42:19 This is because it's part tool.

42:20 It's a tool to do it, but also a guide that says, look, this is how you should deploy.

42:24 So the app puts together the environment for how you should deploy your Django app or, you

42:29 know, you can do any app, but you know, I begin with Django because that's where obviously

42:34 what I know.

42:34 And then the difference between, well, why wouldn't I, why would I use that instead of

42:39 a platform as a service like Kuroka?

42:40 Well, because if you go out of it, it's just AWS.

42:44 And so you can go on and move on to other things and you can export to.

42:47 When you do go closer to now you are kind of Google or whatever.

42:51 You've got a growth path.

42:53 Obviously not, not far down that road, but a little ways you can go, oh, we actually need

42:57 to do this other thing.

42:58 Yeah.

42:58 And so that's what I'm aiming for.

42:59 And that that's launching very soon.

43:01 It'd be early access by the middle of February.

43:03 You know, beta by end of the quarter.

43:06 And then what I call version, what ends the beach?

43:09 I don't know.

43:09 End of the year, I would imagine.

43:10 Yeah.

43:11 Yeah.

43:11 That sounds really cool.

43:12 We'll definitely link to it in the show notes.

43:14 When I was pausing there, I said, okay, well, on one end we have pass like Heroku and other

43:20 platform as a service options.

43:21 What is the other end?

43:22 Is the other end Linux virtual machines or is the other end Kubernetes clusters?

43:28 It's Kubernetes cluster.

43:29 It's well beyond virtual machines, right?

43:31 So like to spin up a virtual machine is not a problem.

43:35 The problem is that you get a bare OS and then you've got to do all the app to get installed

43:40 to turn it into something you can deploy on.

43:43 Right.

43:43 And then you do that once.

43:45 And then the second problem is that six months later you need to upgrade it and you've got

43:48 to replace that VM.

43:50 So that's very difficult.

43:51 And I think that's what leads people into this kind of world of containers.

43:55 And then into containers, it's like, oh, well, I've got, I need an orchestration platform

43:59 to, ah, and that's, there are people who make a career doing that.

44:04 Yeah.

44:05 You can't expect to do that sensibly.

44:06 I agree with Carlton.

44:07 It depends slightly in that, like, so in my professionals book, we, I show how to use Docker

44:11 and Docker is for a smaller site.

44:14 I think actually you can put your containers online so you can, in a lot of different flow

44:19 is actually quite nice.

44:21 But I agree with Carlton's broader point about, you know, that is and all the rest.

44:24 It's, I feel like is the goal.

44:26 I'm setting up a Kubernetes cluster and I'm running the data layer and I'm running the caching

44:30 layer.

44:30 And I'm, if you're managing that whole thing in a cluster, you're at the far right end

44:35 of the most complicated.

44:37 But if I'm going to deploy to a hosted Kubernetes container and consume a database as a service

44:42 and a caching tier as a service, then it starts to fall back to, well, I just get my

44:46 container to run and plug in these connection strings and we're good to go.

44:49 I think there's, it can kind of live on both sides, honestly.

44:52 There's different approaches and different sweet spots for each individual.

44:55 The difference for me is you can containerize your application and run it up, but where do

45:00 you container that to?

45:01 Where do you run that container?

45:02 Is that on a set of VMs, which you provisioned yourself and put a container management system

45:07 on like Kubernetes?

45:07 Or is that on somebody else?

45:10 Like, is it basically service, the Cloud Run?

45:12 Cloud Run takes your container and runs it and you don't know anything about where it's

45:17 running.

45:17 So that's more like a platform as a service again.

45:20 Yeah, it is.

45:21 It falls back in that.

45:22 So Will said he's a fan of Heroku.

45:24 Carlton, let me ask you this question.

45:25 If you were writing an application in Django that was expected to get 5 million data-driven,

45:31 like proper requests, not for CSS and whatnot, but proper requests a month, how would you deploy

45:36 it right now?

45:37 I would deploy it on a pretty big VM with as many process workers as I need.

45:43 So I'd put stick Nginx as my front end.

45:45 Perhaps I'd probably use something like application load balance in front of it, one of these things

45:50 that AWS will provide or Azure have got their equivalent load balancer.

45:53 Then I'd have my Nginx, which is serving my static files.

45:56 Behind that, I'd probably have two, three.

45:58 It's also doing SSL, for example, right?

46:00 Your Let's Encrypt bits.

46:01 Yeah.

46:02 Yeah, yeah.

46:02 And they're handing all certificate renewals and all of that kind of thing, which is probably

46:06 worth the money because it only takes you a few minutes.

46:08 But you forget and then your site goes down and no, just hand all that stuff off.

46:12 So I'd put that on a nice size VM.

46:15 I'd have, you know, three, four, five Gunnicorn workers serving the application instances,

46:19 load balanced behind Nginx.

46:22 And then I'd have Postgres on a decent size RDS, which is a managed database service behind

46:28 it.

46:28 As a first preference, I would scale up the VM and I would scale up the RDS rather than-

46:34 Way before you scale out.

46:35 Yeah, way before I scale out.

46:37 Yeah, I agree.

46:38 Like if you can, as soon as you have them scaled out, it gets tricky, right?

46:41 You become, it takes you up a notch in that DevOps story.

46:44 At that point, you're hiring, you know, an extra hand just to manage the ops, an extra

46:48 hand to manage the ops.

46:49 Yeah.

46:50 It's like, well, what was the revenue of the application that justified that the salary and

46:54 the social security of that extra hand?

46:55 Yeah.

46:56 I mean, maybe you're like, well, I don't really want to pay for that larger VM that's $80 a

47:00 month instead of $10 a month.

47:02 But if the alternative is now we spend human hours on making, you know, three $10 VMs run,

47:08 you know, it's so easy for businesses to become Pennywise pound foolish around these kinds

47:12 of things, right?

47:13 It's just like, oh, we can't get you a new monitor, a new keyboard.

47:16 Like, really?

47:17 You pay me like $80,000 a year and you won't give me a new keyboard to be more productive?

47:21 Or I feel like that's the deployment equivalent of that.

47:24 Yeah.

47:24 No, it's penny pinching for no reason.

47:26 I mean, the other great example is Sentry, right?

47:28 So Sentry is your kind of, you log all your errors to it, send your exceptions to it.

47:33 It gives you great stack traces and it links it back to GitHub.

47:35 It's awesome.

47:35 Why would you not have this?

47:37 And then you're on the free account, you know, it'd give you 5,000 events a month or something.

47:41 And it's like, oh, we need 30 bucks to get onto the, like the million events a month.

47:45 The manager's like, no, you can't have paid Sentry.

47:47 You're like, what?

47:48 What are you talking about?

47:49 So then you stop logging.

47:51 You're like, well, we can't log that event because of Sentry.

47:53 And then you're blind.

47:55 And then your app goes down and you spend four hours trying to work out what it is while you're losing business.

48:00 Like, that was 30 bucks a month for Sentry.

48:02 Just pay it.

48:03 But I think it depends if your manager has felt that pay as an individual contributor themselves, right?

48:08 Because if they haven't, then yeah, stop complaining, developer, you know?

48:12 But yeah, you should, I always thought, I mean, at Quizlet, which is now like half of all high school students,

48:17 we had a joint, which I hope they're still around.

48:19 They're a hosting company, but we were having scaling issues.

48:21 They came in and we had the whole team CTO, which was great.

48:24 And, you know, at the end of the day, they were just like, you need bigger hardware, you know?

48:28 Get more hardware.

48:29 If you can get more, you know, and as a business person, if you can throw money at a scaling problem,

48:34 like, yeah, that's the easiest money you've spent.

48:37 Yeah.

48:37 You know, so what I'm doing right now, Carlton, is I'm running Nginx on Ubuntu, but I'm using MicroWhisgee.

48:44 And I came across this, although as I'm starting to think about the ASGI stuff,

48:50 Gunicorn, Genicorn, and like UVicorn worker processes is starting to look like a really awesome thing.

48:56 But what I wanted to point out is there's this great article by the Bloomberg tech folks

49:00 talking about configuring MicroWhisgee for production.

49:04 And man, do they have a bunch of good little tips of like, well, here's all these things,

49:07 but oh, did you know if you turn on like enable threads versus not, or if you set single interpreter

49:13 mode to true, you automatically get better performance because it was configured to potentially run

49:18 like Python 3.7 and 3.8 at the same time.

49:20 And you're never going to do that in one process, most likely.

49:23 And there's just all these really fantastic settings and like vacuum and whatnot to clean up sockets and whatnot.

49:30 So people, if they're running MicroWhisgee in production, they should absolutely check that out.

49:34 That's a really, I read it a bunch of the way I was doing things after reading that one.

49:38 Just scroll to the image at the top, if you would please, Michael, because a little diagram that I had.

49:41 Yeah.

49:41 But like, yeah, so that looks almost exactly how I deploy.

49:44 Like Nginx in front of a worker process, you know, that's running your Python applications

49:49 and, you know, talking to your database.

49:51 Yeah, exactly.

49:52 It's, it's pretty standard.

49:53 Yeah.

49:53 They got memcached in there.

49:54 So I'd, I'd have Redis instead of memcached, but same deal.

49:57 Yeah.

49:57 There's a comment about, does EC2 sit between a VPS and Kubernetes?

50:01 Yeah.

50:02 Since you're AWS expert.

50:04 Okay.

50:05 Well, I don't know about expert, but so, but on AWS, like you, this is what I haven't found in AWS.

50:10 Like I would love to love their light sale product, but it just seems totally uncared where they,

50:15 they kind of manage the cluster all for you.

50:17 But on the, the, I can't even remember what the cluster services called, but the,

50:20 you have to provision the EC2 instances and you can do it quite easy.

50:24 It's not hard to do, but you have to spin those up and they're kind of your responsibility.

50:28 And then it will run the cluster service on top of it.

50:32 The Kubernetes on top of it.

50:33 And then you deploy your containers in there.

50:35 This is where something like Cloud Run is a bit easier because you don't have that layer of I'm

50:40 provisioning the, the underlying instances myself.

50:42 And you have to choose the size of them and you can scale them up easily enough, but you

50:47 know it's, it's, it's non-trivial to set up a cluster on AWS.

50:50 Yeah.

50:51 That's always been my feeling as well.

50:52 I also feel like you're sort of committed to their hosted services.

50:56 And if for some reason you don't want to use them, the step is not a tiny bit more.

51:00 It's a bigger, a much bigger step to like try to rework that.

51:03 Yeah.

51:03 The example is run, you can run your own Postgres on EC2 instances when, you know, you can provision

51:09 the disks and you can do all that rather than RDS.

51:13 And for me, I'm like, okay, if you've got a very specialist use case, then yeah, do that.

51:17 But RDS is great.

51:18 Just use RDS.

51:19 Just use the hosted service because again, you're saving money and yet it's a bit more expensive

51:24 hour, but not as expensive as you, your time, your life force.

51:28 Yeah.

51:28 Well, I think also it depends, right?

51:30 Are you one single person who is building up an idea and you have zero revenue and you're

51:37 just trying to do this for two hours a week to see if you can get a little tiny bit of traction.

51:41 Maybe it is worth an extra five hours, right?

51:43 Versus I have actual money coming in the door and I'm trading out building this feature or

51:48 that feature.

51:48 Like those are really very different contexts.

51:51 Also though, you get yourself a Raspberry Pi and you can install Nginx on it and Postgres

51:56 on it.

51:56 And no, but you can run all those, right?

51:58 And you can do it locally and you can bet you can run a Apache bench again against it and

52:03 you, it will serve plenty.

52:04 So you can get not the nano one, but yeah, sure.

52:08 But you can get, you can run Postgres is my point.

52:11 You don't need RDS to run a small Postgres, but if you're running a slightly bigger one, then

52:17 yeah, use RDS.

52:18 And then if you're a specialist and you really need to customize your Postgres somehow,

52:23 then okay.

52:23 Yeah.

52:24 You know, spin up the EC2, install Postgres on it and customize it to your heart's content.

52:27 But that's well beyond my skill level.

52:30 And yeah.

52:30 This is why they have hundreds or thousands of employees, right?

52:33 Like when people say, why do the big companies do that?

52:36 It's like, well, why does Instagram have a thousand, whatever thousand engineers when Carlton,

52:40 you and I could spin up a, you know, a prototype relatively quickly.

52:44 It's like, because we're not dealing with the traffic they are.

52:47 And so it just gets exponentially harder, which is why you need a lot of people for all these

52:52 issues.

52:52 Absolutely.

52:53 Will, you mentioned something really interesting there that I would like to just touch on for

52:57 a moment.

52:58 Then we're getting short on time.

52:59 You said you could run SQLite.

53:01 Oh, well, so that Carlton has a good story about SQLite.

53:04 I mean, about how it's, so generally people say, well, you can't use it.

53:07 You shouldn't use it at all.

53:09 But there are some cases where that's not the case.

53:11 I mean, if it's a read heavy application, you can probably get away with it.

53:14 Simon Wilson's doing a lot with data set.

53:16 Yeah.

53:17 I just had him on the show.

53:18 His episode just came out this week, actually.

53:20 Yeah.

53:21 He's great.

53:21 And that is such a cool project.

53:23 I feel like that is actually an undersold story for the beginners, right?

53:28 Because deployment of web application often means deployment of web application plus database

53:34 server, plus backups of database server, plus like all of a sudden it goes from, you know,

53:40 20% to 90% hard or whatever, right?

53:42 Or you go to hosted and you're like, okay, well, I still got to backup that thing potentially.

53:46 And, you know, there's just, you've got potential migrations.

53:49 I don't know.

53:50 There's a lot of stuff going on.

53:51 And if you can say, well, until you actually get much traffic, you can just say, here's

53:55 the DB file and the SQLite connection on the one machine that I have.

53:59 And you back up that file every now and then, that might be a good story.

54:02 If the alternative is it's too much for me to get my app out.

54:05 Yeah, yeah.

54:05 No, definitely.

54:06 Especially if it's a blog or a content site, like a shop catalog where it's all read only

54:11 and, you know, maybe you're using the admin to manage the content on it.

54:14 If it's only one person using the admin, you're not going to have concurrent rights, which

54:18 is the thing about SQLite.

54:20 And so it's never going to be an issue.

54:22 And it is fast.

54:23 It's fast.

54:24 Read only workloads.

54:26 It's fast.

54:26 It's fast enough.

54:27 It's yeah, it's very fast.

54:28 Yeah, you can use it.

54:29 And there's no server for people who don't understand are not totally aware.

54:32 Like it comes with Python and it runs in process.

54:35 There's no other server to set up and connect to.

54:37 Yeah.

54:38 So Carlton correct me on that at one point, because I was saying, oh yeah, no SQLite.

54:42 And he was, so I have to give credit to Carlton for there are some instances.

54:45 Here's the secret about SQLite.

54:49 It's got a writer headlock.

54:50 A wow mode, which means that actually you've got a good chance of being able to do kind

54:57 of concurrent rights to Django's ORM has got a retry value, which if you set that, you know,

55:02 you know, a little bit higher.

55:03 If it gets database locked, it will try again in a second.

55:07 And then, you know, you can go quite a long way enabling these things.

55:10 And then when you finally in production actually get a database was locked error, then you could

55:16 think, you know what?

55:16 I think it's time we move to post.

55:18 Yeah.

55:18 In my world, I'm running MagaDB as the database.

55:21 And it doesn't make sense to consider running that on SQLite.

55:24 But I can remember back when I first started deployment, like, okay, well, I got to learn Linux.

55:28 I got to learn Ingenx.

55:29 I got to learn MicroWisgee.

55:30 Like, okay, what other deployment?

55:32 Like, how do I have to learn running my database on these things?

55:35 There's just, there was a lot.

55:36 And I can definitely see if you could say, well, here's an intermediate step to get it

55:40 out and get it going.

55:41 And then you just change the connection string at some point over to a big separate server.

55:45 I think that's a really good path.

55:47 It's a little bit like, you know, raw SQL versus Django models.

55:51 This is timely because I've had a thread emailing with a reader who doesn't quite, has something

55:56 in mind.

55:56 And he's like, I modeled it all out, the scheme all out in SQL.

55:59 And SQL is easy to learn the basics and really hard at scale.

56:03 And while Django lets you write SQL, you really, really, really should resist doing that unless

56:09 you're a way better programmer than I am.

56:11 So whereas before you would have to learn tons of stuff, the same thing with deployment,

56:16 you can get a lot of the way there by trusting someone who says, until you need it, don't

56:21 bother.

56:21 The same thing with database stuff.

56:23 Like, okay, you know, do some basic SQL, understand a little bit of the relations, but that's the

56:27 power of the Django ORM is that it will handle so much of this for you.

56:30 And if you think you need to go custom, unless, you know, if you have any doubts, you shouldn't

56:34 do it.

56:34 Yeah.

56:35 And the migration side, that's a huge part of a challenge if you were maintaining it yourself.

56:39 Yeah.

56:40 Yeah.

56:40 I mean, I was, you know, Andrew, Andrew was responsible for the, doing most of the, a lot

56:45 of the async stuff now.

56:46 Nice.

56:46 All right, guys, we're getting short on time, but I do want to just really quickly cover

56:49 one more thing.

56:50 Servers up and running, feels like it works.

56:52 I watched it all day.

56:53 It was fine.

56:54 I want to walk away from my desk.

56:56 I want to know that it's probably still fine.

57:00 And to me, like Carlton, you already talked about one thing.

57:03 There's some really great monitoring services that you integrate at the API level.

57:06 Like you plug in as a library to your code.

57:09 Sentry being one of them.

57:10 They're really great.

57:11 They sponsored the show for a while.

57:12 Thanks for that as well.

57:13 But I use Sentry on.

57:15 Yeah, they're great.

57:15 And I, I've got Sentry running on my apps and every now and then I'll get an email.

57:19 And a lot of, at this point, when I first integrated that type of service, I got a lot of, oh, I

57:24 didn't know that was happening.

57:25 Oh crap.

57:26 I'm going to have to fix that.

57:27 Well, that's why there's a lot of logging and stuff, right?

57:29 Yeah.

57:29 Yeah, absolutely.

57:30 And once I kind of dialed in now, it's more like, well, somebody tried to send like some

57:34 binary hacky thing that broke the URL parsing, but it's not really a problem.

57:39 It's just right.

57:39 But having that thing there is, is really important.

57:43 I think.

57:43 Yes, absolutely.

57:44 Absolutely.

57:45 Sentry.

57:46 I, I just can't see a reason not to use it.

57:48 Even if they've got the free plan.

57:49 Why wouldn't you have that?

57:51 Yeah.

57:51 The free tier, like once you run out, you can decide whether or not you want to pay for it.

57:54 But, you know, at least get, get us some kind of insight into the errors that are happening.

57:59 Yeah.

57:59 The other thing that I'm a fan of is Prometheus.

58:01 It takes a teeny bit of setting up, but again, you can get yourself a Raspberry Pi and you

58:05 can play with that locally.

58:06 And it's not that hard.

58:07 You can put it on your Mac or you put it on your Windows machine.

58:09 It will run, but get a Raspberry Pi, set it up, monitor the device.

58:13 Prometheus is good fun.

58:15 There's a dashboard that goes with it called Grafana.

58:17 And then they do a log thing called Locky, which, you know, you have to configure it yourself,

58:21 but it teaches you about your application.

58:23 You have to say, okay, I want to monitor this.

58:25 And then you can put a little couple of tags in and then, okay, you get metrics then for

58:30 that bit.

58:30 So, you know, perhaps you've got a slow view.

58:32 So one thing you can do is you can put on your Nginx logs, you can log the upstream response

58:38 time.

58:39 So you've handed off to Garnicorn or to Microwiskey and Nginx will then log how long those responses

58:44 took.

58:44 And then you can say, well, actually that those responses to that particular request is taking

58:48 a long time.

58:48 And then on that request, you can go into that view and you can add a little, you know,

58:52 a little bit of instrumentation and then you can start getting metrics for what that view

58:56 is doing.

58:57 And yeah, yeah.

58:58 You know, that's really good.

58:59 He does over all of you guys.

59:00 Yeah.

59:00 I'm also a fan of Datadog.

59:02 I think those sound pretty similar.

59:03 Okay.

59:04 I think they're Boston based actually, but yeah, they do.

59:06 They call it APM application process monitoring.

59:09 And so there's quite a lot of commercial solutions.

59:11 And then Prometheus is the sort of DIY.

59:14 Nice.

59:14 Equivalent.

59:15 Okay, cool.

59:16 So that's the errors and performance.

59:18 The other side is just the website is down, right?

59:22 So maybe there's so many different layers and moving parts.

59:25 For example, like we have very little downtime with our train courses and stuff.

59:29 But one thing that did happen is we have this thing that will take the main IP address and

59:33 switch it to a failover server so we can do reboots and patches and then it'll switch it

59:38 back.

59:38 And that's all done through an API through like a get push.

59:41 And then it all just sort of goes down the chain.

59:43 Well, at one point there was a bug where that switch of the IP like disassociated it with either

59:49 server.

59:50 So the server thought it was fine.

59:51 It's like, well, things are chill, right?

59:53 Right.

59:53 So you log in and it's like, yeah, no problem.

59:55 But the site was just timing out or so.

59:57 I don't remember what happened, but it wasn't good.

59:59 So I think there's some really nice uptime monitoring things that are free that people

01:00:04 should just plug in to go hit these three pages just to see.

01:00:07 I can talk to the site.

01:00:08 It talks to the database and the answer comes back.

01:00:10 Yeah, for sure.

01:00:10 I mean, I've got those configured.

01:00:11 I was I know we're almost out of time.

01:00:13 I did want to mention on deployment.

01:00:14 I think one thing that trips people up, especially around Django is static files, which is something

01:00:18 if you're doing it, you know, VPS, you know, and I think the key thing is that

01:00:23 your server doesn't want to run your static files like it can ways to do it.

01:00:28 But, you know, so both within Django, Django out of the box defaults to local settings.

01:00:32 And the Django has a local server.

01:00:34 They'll just run your static files to put that into point and deployment.

01:00:38 You would run collect static, which is a command that makes a single static file.

01:00:42 And you probably want to use something like white noise.

01:00:44 But there's a couple of steps there.

01:00:45 But something that really sort of intermediate level Django people, it really trips them up.

01:00:49 I have a blog post on that because I forget the commands.

01:00:52 There's like four things to tweak.

01:00:53 You just have to do every time.

01:00:55 It works locally.

01:00:56 Why doesn't it work live?

01:00:57 And it's like partly because people don't understand, you know, how their server is working because

01:01:01 they don't have to.

01:01:02 But, you know, that's I just want to.

01:01:04 Yeah.

01:01:05 Awesome.

01:01:05 Yeah.

01:01:06 One of the big four.

01:01:07 Right.

01:01:07 So get your code in place.

01:01:08 However you do that.

01:01:09 Tab or get pulled.

01:01:10 You know, whatever.

01:01:11 How do you get it there?

01:01:12 Configure your virtual environment.

01:01:13 You know, so in pip installed all your requirements.

01:01:15 Configure your database and make sure you connect to that and get your static files in place.

01:01:19 Database is the other one that, you know, well, you know, this might go like beginners.

01:01:23 They're like, well, I updated it locally and I pushed my code.

01:01:26 Why isn't my production database different?

01:01:28 Right.

01:01:29 And it is like I still occasionally make that mistake, you know, just but, you know, your code

01:01:34 is not your two separate databases.

01:01:36 Yeah, absolutely.

01:01:37 That's what you want as well.

01:01:38 You want to be able to write your blog post in locally and then it appear on your server.

01:01:43 You don't want to have to go, oh, no, now I have to paste it into the admin on my remote.

01:01:46 Yeah, it depends how automated you want to go.

01:01:48 I mean, for a simple like so my learn Django site, which is basically one admin, largely

01:01:53 a content site.

01:01:54 I mean, in terms of easy peasy, it's just Django and I've got Cloudflare in front and it's done.

01:02:00 It's super fast.

01:02:01 I get, you know, decent amount of traffic.

01:02:04 I don't have to think about it.

01:02:05 I've got I think I've got PagerDuty, one of those, you know.

01:02:07 Yeah.

01:02:08 Yeah, that's the one that tells you if it's completely unreachable, right?

01:02:12 Yeah, yeah.

01:02:12 But it's an external one that, you know, exactly to your point, because you can't always trust

01:02:17 yourself.

01:02:17 Yeah.

01:02:17 Yeah.

01:02:18 There's some interesting ones.

01:02:19 I use status cake and it's neat.

01:02:21 But there's some one that I heard the Dan Bader was telling me about that would sound a lot

01:02:25 nicer, but I'm like, but this one's already set up.

01:02:26 You know, it's not that important.

01:02:29 I get I get notifications.

01:02:30 If it goes down, I'm all good.

01:02:31 It's plumbing, right?

01:02:32 Like, I'm happy to live.

01:02:33 We have the new silver pipes.

01:02:35 Like, yeah, my bronze pipes.

01:02:36 Fine.

01:02:37 I'm just gonna leave it.

01:02:37 Well, that's Docker for Carltons, you know, so.

01:02:39 I use Docker loads.

01:02:41 All right, guys.

01:02:43 Yeah.

01:02:44 No, all the time.

01:02:45 All the time.

01:02:45 Let's just wrap it up really quick.

01:02:46 There's a Django newsletter.

01:02:47 I learned about that.

01:02:48 That's interesting.

01:02:49 You guys want to just mention that that exists?

01:02:50 Yeah.

01:02:51 Yeah.

01:02:51 So that's something I run with Jeff Triplett, who's a partner at RevSys.

01:02:54 He's a Python board member, very involved with Django.

01:02:56 So Django-news.com.

01:02:58 There wasn't a regular Django newsletter.

01:03:01 There wasn't a podcast.

01:03:02 So he and I have been doing that for a little over a year and has projects, articles.

01:03:06 I sort of wish someone else did it, so I didn't have to do it.

01:03:08 But we got a lot of people using it.

01:03:11 So that's a good resource for the community.

01:03:13 Yeah, fantastic.

01:03:13 All right.

01:03:14 So before I let you two out of here, final two questions really quick.

01:03:17 Will, I'll go with you first.

01:03:19 Notable PyPI package out there that you were like, oh my gosh, I ran across this the other

01:03:23 day.

01:03:23 I can't believe it.

01:03:24 That's a good question.

01:03:25 I'll go back to an old school one, which I think is Bleach, because I've been thinking

01:03:30 about a course on forms.

01:03:31 And Bleach is a Python one, not Django-specific, but you pretty much always want to have that

01:03:36 added.

01:03:37 So this validates user input to make sure there's no cross-site scripting type stuff?

01:03:41 Yeah.

01:03:42 So that's top of mind.

01:03:44 Not a new one, but I think along with white noise, you just got to use it.

01:03:48 Yeah.

01:03:48 Awesome.

01:03:48 Carlton?

01:03:49 Yeah.

01:03:49 No.

01:03:49 Well, the one that's just really captured my imagination recently is Rich, which is the-

01:03:54 Yeah, Rich is cool.

01:03:55 the library for creating basically nice terminal output, nice console output, but it does

01:04:01 everything.

01:04:01 It even has like tables and all sorts of stuff.

01:04:04 Yeah.

01:04:04 Yeah.

01:04:04 It's really neat.

01:04:05 But like, it's got this inspect functionality where you can get an old, and you're sitting

01:04:09 there and you're in this shell and you're like, I want to see it.

01:04:12 And you print it and you deer it and you look at the dict and it's all, it's not, and then

01:04:16 you go inspect, and Rich formats this thing where it's like, oh yeah, I can look here and

01:04:21 I can see exactly what's going on.

01:04:23 And it's just amazing.

01:04:24 Rich is brilliant.

01:04:25 And 20,000.

01:04:25 That's what I love about coding, right?

01:04:27 I'd never heard of this before and it's clearly a very established thing.

01:04:31 Well, I think it's last year.

01:04:33 It's taken off quite, yeah, it's about a year old.

01:04:35 It's taken off quite steeply in its adoption.

01:04:37 One that I ran across really recently, just throw it out there because it's a Django semi-related

01:04:42 one, is Disk Cache.

01:04:43 Have you guys heard of that?

01:04:44 No.

01:04:44 So it's a really interesting caching plugin that will, instead of using memory for caching,

01:04:50 it will store it onto local disk because you usually have way more hard drive space than

01:04:54 you have memory in the cloud.

01:04:55 And it plugs into Django to like a stand in for the cache there.

01:04:59 Okay, fine.

01:05:00 Yeah.

01:05:00 I mean, I'm a big fan of file cache in general because like memory is expensive, right?

01:05:05 So memory cache is the best way and Redis and Memcache are good ways of doing that all

01:05:10 in memory.

01:05:10 But then you think, I just want to generate some HTML once and then just pipe it off the

01:05:15 hard disk.

01:05:15 Exactly.

01:05:15 To me, this is kind of the equivalent of SQLite versus a real database.

01:05:19 It's like, you don't need Redis or Memcache or something like completely set up just like

01:05:23 until it gets beyond whatever.

01:05:25 It looks pretty interesting.

01:05:26 You do these packages things, by the way.

01:05:27 Like we include packages every week in Django News and there's also like an awesome Django

01:05:31 repo that Jeff and I do.

01:05:33 You know, because the problem is you want some degree of curation, right?

01:05:36 Like something new.

01:05:37 That's right.

01:05:37 Like legit enough to be worth looking at.

01:05:39 Yeah, absolutely.

01:05:40 Thanks.

01:05:40 Yeah, that's very cool.

01:05:41 All right.

01:05:42 And then final question.

01:05:43 If you're going to write some Python code, what editor do you use?

01:05:45 VS Code.

01:05:46 Same for both of us.

01:05:47 Yeah.

01:05:48 Right, Carlton?

01:05:48 You're still in the other code?

01:05:49 Well, I have to.

01:05:50 Yes.

01:05:51 VS Code.

01:05:52 Very nice.

01:05:53 Use it a lot.

01:05:53 Also, though, I still like BBEdit.

01:05:55 Yeah, right on.

01:05:56 All right.

01:05:56 Keeping it old school every now and then just for a little nostalgia.

01:05:59 I'll tell you what, right?

01:06:00 So I'm using VS Code and I'm like, but I need to do some transformations or I need to,

01:06:05 you know, do a multi-file search and a diff here.

01:06:07 And VS Code's got all that stuff, but it's a bit, you know, this is built in JavaScript,

01:06:11 whereas BBEdit's a native Mac app and it's got a lot going.

01:06:13 Yeah, absolutely.

01:06:14 I use PyCharm.

01:06:15 Yeah, I'm a big fan.

01:06:17 Local company here in Portland, Panic, came out with, what's it called?

01:06:20 Nova?

01:06:21 I think it's Nova.

01:06:22 They just came out with a brand new editor.

01:06:23 Yeah, yeah, yeah.

01:06:23 I want to give that a go.

01:06:23 It looks pretty interesting as well, yeah.

01:06:25 It looks just beautiful.

01:06:27 Transmit.

01:06:27 I love Transmit.

01:06:28 Yeah.

01:06:29 I use it all the time.

01:06:30 All the time.

01:06:31 For S3 stuff.

01:06:32 We were talking about Nova, yeah.

01:06:33 Fantastic.

01:06:33 Cool.

01:06:33 All right, gentlemen.

01:06:35 Thank you so much for being on the show.

01:06:36 Thank you for having us.

01:06:38 Yeah, it's been great.

01:06:39 And thanks for all the work on Django and I'll catch up with you all soon.

01:06:42 All right.

01:06:42 Thanks for having us.

01:06:43 This has been another episode of Talk Python to Me.

01:06:47 Our guests on this episode were Will Vincent and Carlton Gibson, and it's been brought to

01:06:51 you by Square and Linode.

01:06:53 With Square, your web app can easily take payments, seamlessly accept debit and credit cards, as

01:06:58 well as digital wallet payments.

01:07:00 Get started building your own online payment form in three steps with Square's Python SDK

01:07:05 at talkpython.fm/Square.

01:07:09 Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines.

01:07:13 Develop, deploy, and scale your modern applications faster and easier.

01:07:17 Visit talkpython.fm/Linode and click the Create Free Account button to get started.

01:07:22 Want to level up your Python?

01:07:24 We have one of the largest catalogs of Python video courses over at Talk Python.

01:07:28 Our content ranges from true beginners to deeply advanced topics like memory and async.

01:07:33 And best of all, there's not a subscription in sight.

01:07:35 Check it out for yourself at training.talkpython.fm.

01:07:38 Be sure to subscribe to the show, open your favorite podcast app, and search for Python.

01:07:43 We should be right at the top.

01:07:45 You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the

01:07:50 direct RSS feed at /rss on talkpython.fm.

01:07:54 We're live streaming most of our recordings these days.

01:07:57 If you want to be part of the show and have your comments featured on the air, be sure to

01:08:01 subscribe to our YouTube channel at talkpython.fm/youtube.

01:08:06 This is your host, Michael Kennedy.

01:08:07 Thanks so much for listening.

01:08:08 I really appreciate it.

01:08:09 Now get out there and write some Python code.

01:08:11 We'll be right back.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon