{"title":"How to use Django with Uvicorn","version":"3.1","locale":"ja","docname":"howto/deployment/asgi/uvicorn","url":"/ja/3.1/howto/deployment/asgi/uvicorn/","canonical":"https://djangodocs.dev/ja/3.1/howto/deployment/asgi/uvicorn/","summary":"Uvicorn is an ASGI server based on uvloop and httptools , with an emphasis on speed. Installing Uvicorn Link to this heading # You can install Uvicorn with pip :…","html":"<h1>How to use Django with Uvicorn<a class=\"heading-anchor\" href=\"#how-to-use-django-with-uvicorn\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><a class=\"reference external\" href=\"https://www.uvicorn.org/\">Uvicorn</a> is an ASGI server based on <code class=\"docutils literal notranslate\"><span class=\"pre\">uvloop</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">httptools</span></code>, with an\nemphasis on speed.</p>\n<section id=\"installing-uvicorn\">\n<h2>Installing Uvicorn<a class=\"heading-anchor\" href=\"#installing-uvicorn\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>You can install Uvicorn with <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code>:</p>\n<div class=\"code-block\" data-language=\"bash\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>uvicorn<span class=\"w\"> </span>gunicorn\n</code></pre></div>\n</section>\n<section id=\"running-django-in-uvicorn\">\n<h2>Running Django in Uvicorn<a class=\"heading-anchor\" href=\"#running-django-in-uvicorn\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>When Uvicorn is installed, a <code class=\"docutils literal notranslate\"><span class=\"pre\">uvicorn</span></code> command is available which runs ASGI\napplications. Uvicorn needs to be called with the location of a module\ncontaining an ASGI application object, followed by what the application is\ncalled (separated by a colon).</p>\n<p>For a typical Django project, invoking Uvicorn would look like:</p>\n<div class=\"code-block\" data-language=\"bash\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>gunicorn<span class=\"w\"> </span>myproject.asgi:application<span class=\"w\"> </span>-k<span class=\"w\"> </span>uvicorn.workers.UvicornWorker\n</code></pre></div>\n<p>This will start one process listening on <code class=\"docutils literal notranslate\"><span class=\"pre\">127.0.0.1:8000</span></code>. It requires that\nyour project be on the Python path; to ensure that run this command from the\nsame directory as your <code class=\"docutils literal notranslate\"><span class=\"pre\">manage.py</span></code> file.</p>\n<p>For more advanced usage, please read the <a class=\"reference external\" href=\"https://www.uvicorn.org/\">Uvicorn documentation</a>.</p>\n</section>","rootId":"how-to-use-django-with-uvicorn","toc":[{"title":"Installing Uvicorn","anchor":"installing-uvicorn","children":[]},{"title":"Running Django in Uvicorn","anchor":"running-django-in-uvicorn","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"「How-to」ガイド","url":"/ja/3.1/howto/"},{"docname":"howto/deployment/index","title":"Django をデプロイする","url":"/ja/3.1/howto/deployment/"},{"docname":"howto/deployment/asgi/index","title":"How to deploy with ASGI","url":"/ja/3.1/howto/deployment/asgi/"}],"prev":{"docname":"howto/deployment/asgi/hypercorn","title":"How to use Django with Hypercorn","url":"/ja/3.1/howto/deployment/asgi/hypercorn/"},"next":{"docname":"howto/deployment/checklist","title":"デプロイチェックリスト","url":"/ja/3.1/howto/deployment/checklist/"},"formats":{"html":"/ja/3.1/howto/deployment/asgi/uvicorn/","markdown":"/ja/3.1/howto/deployment/asgi/uvicorn.md","json":"/ja/3.1/howto/deployment/asgi/uvicorn.json"},"source":"https://github.com/django/django/blob/stable/3.1.x/docs/howto/deployment/asgi/uvicorn.txt","official":"https://docs.djangoproject.com/ja/3.1/howto/deployment/asgi/uvicorn/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0"],"inLocales":["en","zh-hans","fr","ja","id","pt-br","ko","es","el","pl"]}