Python for decision makers and business leaders Transcripts
Chapter: Web development with Python
Lecture: Python web frameworks galore
0:00 In this chapter, we're going to talk
0:01 about web development with Python
0:03 the whole spectrum of Python web frameworks
0:06 how to pick one, and for the first time
0:09 so far in this course, we're going to write
0:10 a little bit of code.
0:12 That's right, we're going to create a web application
0:14 a very simple one, and we're just going to hit
0:16 the highlights of creating it.
0:17 But again, it's super important to see
0:19 how effective Python can be
0:21 by seeing just a little bit of it in action.
0:23 So, we're going to do that in this chapter.
0:25 Let's start by doing a quick purvey
0:27 of the Python web frameworks.
0:29 In some technologies, let's say .NET
0:32 there's almost no discussion of what web framework to use.
0:36 In .NET you use ASP.NET, that's the framework
0:39 from Microsoft and so you use that one.
0:42 Yeah, there's some other ones you could pick
0:43 but they're not really used.
0:45 ASP.NET, you don't think about it.
0:47 Maybe you think about variations
0:48 but you don't actually think about the framework.
0:50 In Python, it's not like that at all.
0:52 There are many, many frameworks.
0:54 That's a great problem to have but it is actually
0:56 a problem to decide where you should start.
0:59 Just by name recognition, probably Django is the most
1:03 well-known framework.
1:04 Many of the examples I showed you before
1:06 on who uses Python were actually also who uses Django.
1:11 Django is great and it's been around since 2005
1:13 very popular, gotten a lot going for it.
1:16 However, probably Flask is the one with the most momentum.
1:20 For example, last year, two years ago it was 15% behind
1:23 in usage with Django. It made up 15% in just one year
1:28 and keep in mind, these both have been out
1:30 for like 10 years so it's really starting to take off
1:32 and you'll see its influence all over the place.
1:35 So these are the two big frameworks
1:37 in the Python web development space.
1:39 There's also Pyramid. Pyramid is a great option.
1:41 Actually our websites are built in Pyramid
1:44 and it's really, really been great as well.
1:46 So these are all three really good options.
1:48 Masonite is a newer one that's got a lot of helpers
1:51 to help you continue to add features to your site over time.
1:54 That's cool.
1:55 Starlette is one of the new foundational frameworks
1:58 and I say foundational because it itself is a cool
2:00 framework but there are many things
2:01 built on it as well as you'll see.
2:04 So Starlette is one of the more modern frameworks.
2:07 It really, for Python Three, it takes advantage
2:09 of some of the new language features
2:10 about describing variable types and things like that
2:13 and also supports asynchronous programming.
2:16 Built on top of Starlette is FastAPI
2:19 which is a, maybe one of the best ways
2:20 to build APIs these days
2:22 if it's going to be an API that gets a ton of traffic.
2:25 FastAPI is on par, as fast as NodeJS, as fast as Go
2:31 and it handles the scalability that those frameworks
2:34 do as well so if somebody says, we can't use Python
2:36 for this 'cause it's not scalable enough
2:38 it turns out, actually, FastAPI totally does it.
2:42 To be honest, many of these other frameworks
2:43 also completely do it.
2:45 You know, our site, running on Pyramid
2:46 gets millions of requests per month
2:49 and it does terabytes of data traffic
2:51 and yet it runs just fine on this not so scalable thing
2:54 right, but if you need extreme scalability
2:57 FastAPI is good, Sanic is another one
2:59 that's in that extreme scalability world.
3:02 It's another new framework that embraces
3:04 Python's async and await.
3:05 The async programming capabilities that was recently
3:08 added in Python Three and Tornado is one
3:11 that's been around for quite a while
3:12 and it has, also, this asynchronous programming model
3:15 but it has a older traditional model
3:17 that it's kind of built-in before Python itself
3:20 had something for that.
3:21 Here's a whole bunch of frameworks and, actually
3:23 we're leaving many, many of them out.
3:25 These are just some of the either new and exciting ones
3:28 or the most popular older ones.