ASGIアプリケーションの実行には、候補としてUvicorn・Hypercorn・Daphneの3つがあります。 それぞれの概要と起動方法をみておきます。 ASGIアプリケーション それぞれの特徴を見る前に、確認用のASGIアプリを作成しておきます。 次のコードは、HTTPのレスポンスボディとしてurlのパスを送信します。 main.py async def app(scope, receive, send): headers = [(b"content-type", b"text/html")] await send({"type": "http.response.start", "status": 200, "headers": headers}) await send({"type": "http.response.body", "body": scope["raw_path"]})
![ASGIサーバーであるUvicorn・Hypercorn・Daphneの比較|Tech Press | テックプレス](https://cdn-ak-scissors.b.st-hatena.com/image/square/1b62212b61d76d095872a77e475995db4a9ae614/height=288;version=1;width=512/https%3A%2F%2Ftechpr.info%2Fwp-content%2Fuploads%2F2021%2F09%2F68747470733a2f2f6173736574732e6769746c61622d7374617469632e6e65742f70676a6f6e65732f6879706572636f726e2f7261772f6d61737465722f617274776f726b2f6c6f676f2e706e67-1.png)