3 ms·
It's also worth mentioning that FastAPI/Starlette are async and a bit more annoying to debug.
by systemvoltage 6y ago
It's also worth mentioning that FastAPI/Starlette are async and a bit more annoying to debug.
- _frkl 6y agoflask also supports async now, that's one of the main new features of this release.
- systemvoltage 6y agoI believe Flask 2.0 optionally supports it whereas FastAPI is async only. I could be wrong though. Edit: Thanks for the correction, my point is moot and irrelevant.
- pletnes 6y agoFastAPI happily supports both options in a gradual manner. Just start out sync and convert to async if you want on a per-route basis.
- tedivm 6y agoThat's not exactly accurate. When working with sync views FastAPI dumps them into a threadpool. It basically converts them to async on the fly. To quote the docs- > When you declare a path operation function with normal def instead of async def, it is run in an external threadpool that is then awaited, instead of being called directly (as it would block the server).
- philote 6y agoFastAPI allows you to define non-async views.
- deleted 6y ago[deleted]