{"title":"How to use Django with Daphne","version":"3.1","locale":"pl","docname":"howto/deployment/asgi/daphne","url":"/pl/3.1/howto/deployment/asgi/daphne/","canonical":"https://djangodocs.dev/pl/3.1/howto/deployment/asgi/daphne/","summary":"Daphne is a pure-Python ASGI server for UNIX, maintained by members of the Django project. It acts as the reference server for ASGI. Installing Daphne Link to this…","html":"<h1>How to use Django with Daphne<a class=\"heading-anchor\" href=\"#how-to-use-django-with-daphne\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><a class=\"reference external\" href=\"https://pypi.org/project/daphne/\">Daphne</a> is a pure-Python ASGI server for UNIX, maintained by members of the\nDjango project. It acts as the reference server for ASGI.</p>\n<section id=\"installing-daphne\">\n<h2>Installing Daphne<a class=\"heading-anchor\" href=\"#installing-daphne\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>You can install Daphne 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>daphne\n</code></pre></div>\n</section>\n<section id=\"running-django-in-daphne\">\n<h2>Running Django in Daphne<a class=\"heading-anchor\" href=\"#running-django-in-daphne\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>When Daphne is installed, a <code class=\"docutils literal notranslate\"><span class=\"pre\">daphne</span></code> command is available which starts the\nDaphne server process. At its simplest, Daphne needs to be called with the\nlocation of a module containing an ASGI application object, followed by what\nthe application is called (separated by a colon).</p>\n<p>For a typical Django project, invoking Daphne 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>daphne<span class=\"w\"> </span>myproject.asgi:application\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</section>","rootId":"how-to-use-django-with-daphne","toc":[{"title":"Installing Daphne","anchor":"installing-daphne","children":[]},{"title":"Running Django in Daphne","anchor":"running-django-in-daphne","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"Przewodniki „Jak to zrobić”","url":"/pl/3.1/howto/"},{"docname":"howto/deployment/index","title":"Wdrażanie Django","url":"/pl/3.1/howto/deployment/"},{"docname":"howto/deployment/asgi/index","title":"How to deploy with ASGI","url":"/pl/3.1/howto/deployment/asgi/"}],"prev":{"docname":"howto/deployment/asgi/index","title":"How to deploy with ASGI","url":"/pl/3.1/howto/deployment/asgi/"},"next":{"docname":"howto/deployment/asgi/hypercorn","title":"How to use Django with Hypercorn","url":"/pl/3.1/howto/deployment/asgi/hypercorn/"},"formats":{"html":"/pl/3.1/howto/deployment/asgi/daphne/","markdown":"/pl/3.1/howto/deployment/asgi/daphne.md","json":"/pl/3.1/howto/deployment/asgi/daphne.json"},"source":"https://github.com/django/django/blob/stable/3.1.x/docs/howto/deployment/asgi/daphne.txt","official":"https://docs.djangoproject.com/pl/3.1/howto/deployment/asgi/daphne/","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"]}