Async Techniques and Examples in Python Transcripts
Chapter: asyncio-based web frameworks
Lecture: There is no async support for Flask

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I made a statement that Flask does not operate
0:02 in the async world. It does not support asyncio
0:05 and there's no capabilities or way to turn that on.
0:09 We cannot have async def view method. It just doesn't work.
0:14 So I want to highlight a piece of the documentation
0:17 in Flask 1.0 and then actually give you some news.
0:22 If you go to docs1.0/design
0:25 you'll see this block in there somewhere.
0:27 Design decisions in Flask it says ...
0:30 However Flask is just not designed for large applications
0:33 or Asychronous servers.
0:35 Flask wants to make it quick and easy to write a
0:37 traditional web application, period.
0:40 Flask will not support async, that's what it says right
0:44 in the design decisions.
0:45 It's not intended for asynchronous servers.
0:48 So what the heck is Flask doing in this course?
0:51 Well, two things, first of all, we're going to have
0:54 something that's very, very much like Flask.
0:57 It's compatible with Flask but does support asychronous
0:59 servers perfectly.
1:00 Second I actually recently spoke with David Lord
1:04 who is in charge of Flask these days.
1:06 I interviewed him on Talk Python, the podcast
1:09 and I asked him about this.
1:10 I said, it says this right in the docs.
1:12 He said, yes, but.
1:14 He says that but we're intending to support asynchronous
1:17 at some point.
1:19 Maybe it's going to take a year, maybe even two years
1:21 but they're going to support it.
1:22 So there may be a point where you're watching this video
1:25 and you can just put async def on those Flask methods
1:27 and magic is going to happen
1:29 but at the time of the recording, like I said, 2018
1:32 fall, this is not an option.
1:34 It does not support it and it's still a couple years out.
1:37 Actually the guy that's working on the framework
1:39 that does may be collaborating with the Flask folks
1:41 to make this happen natively in Flask.
1:44 Okay so no async for Flask, maybe just not yet.
1:48 Anyway that's the news.