Async Techniques and Examples in Python Transcripts
Chapter: asyncio-based web frameworks
Lecture: Remember to run on an ASGI server

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So when we talked about the performance and profiling
0:02 and load testing previously, just the previous video
0:06 I said you have to run on an ASGI server.
0:09 WSGI, traditional Web Service Gateway Interface
0:13 that's how Django, Pyramid, Flask, all of them work.
0:16 They're all based on this.
0:18 Basically the underlying web API
0:21 that integrates these frameworks into the server
0:23 those are serial.
0:24 So there's no way to do asynchronous programming
0:27 or execution for those frameworks at all.
0:30 So in order to actually get the scalability
0:32 and to actually execute our code on asyncio event loops
0:37 you have to use what's called as ASGI server.
0:40 An Async Service Gateway Interface
0:43 something to that effect. So you can use Hypercorn.
0:46 Hypercorn comes when you pip install quart
0:48 you get Hypercorn, this is an option.
0:51 It says you don't type run.
0:52 You know, don't like just run this here.
0:55 What you're going to do instead is you type hypercorn
0:58 module name and then app name that you want to run, okay?
1:02 Also lists some others down here, Uvicorn.
1:05 We talked about uvloop based on that, right?
1:08 And some of its capabilities.
1:10 So you can see Hypercorn is pretty awesome.
1:12 I believe it's based on Gunicorn
1:14 much like Uvicorn is as well
1:16 and I honestly don't know enough about them
1:19 to like help you decide between one or the other
1:21 but this one looks like it has more features.
1:23 That seems good. Make sure if you do any load testing
1:27 or you do this in production
1:28 that you run it on an ASGI server
1:31 or you're basically going to get exactly the same
1:33 as what you had with Flask and if that's what you're getting
1:36 you might as well keep the more well-known
1:38 well-tested API, right?
1:40 Be sure to use one of these servers.