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