#100DaysOfWeb in Python Transcripts
Chapter: Days 21-24: Async Flask APIs with Quart
Lecture: Flask will never be async capable
0:00 You've seen this async/await
0:01 programming models, pretty awesome
0:03 and really opens up some cool possibilities
0:05 and the application to the web, really important.
0:08 However, Flask will not operate in a async world.
0:13 Neither does Django, neither does Pyramid
0:15 or many of the other frameworks.
0:17 Now that might change after this is recorded.
0:21 I know Django now has at least a road map
0:24 towards this async world.
0:25 But generally, these popular frameworks are built on
0:28 what are call WSGI, W-S-G-I
0:31 Web Service Gateway Interface.
0:34 And that API cannot be made async.
0:37 So, part of the magic of all these frameworks
0:40 is they are based on this common standard
0:42 the common standard doesn't allow for async.
0:44 Moreover though, for Flask, at least at the time
0:46 of the recording, you check out their design decisions
0:50 and they say, Flask is just not designed
0:53 this is from their documentation
0:54 Flask is just not designed for large applications
0:57 or asynchronous server.
0:59 Flask wants to make it quick and easy
1:01 to write a traditional web application, period.
1:06 Well, it's cool I guess we cover this async stuff
1:08 but Flask does not get support it, so
1:10 forget it we're out of here.
1:12 That's one possible outcome, the other is
1:15 enter this thing called Quart.
1:17 So, Quart was designed by Philip Jones
1:20 who I actually interviewed him on
1:22 the Talk Python To Me Podcast
1:23 and Quart is a Python web
1:25 micro-framework based on asyncio.
1:28 That's the same asyncio we just did magic
1:30 with our producer and consumer world.
1:32 It is intended to provide the easiest way to use
1:35 asyncio in a web context, especially
1:38 with existing Flask applications.
1:41 You'll see that converting a Flask app, into a Quart app
1:44 is actually super, super easy.
1:46 We're going to use Quart to add this, basically the leverage
1:50 this async programming model on the web
1:53 but use everything we know about Flask
1:55 and even Flask extensions in that application
1:58 that we build that is async.
1:59 Even though Flask itself, claims it will not support it.
2:02 So, very, very cool project here
2:04 and we're going to use that to level up our API.