{"title":"ASGI를 사용하여 배포하는 방법","version":"3.2","locale":"ko","docname":"howto/deployment/asgi/index","url":"/ko/3.2/howto/deployment/asgi/","canonical":"https://djangodocs.dev/ko/3.2/howto/deployment/asgi/","summary":"WSGI뿐만 아니라, Django는 비동기 웹 서버와 애플리케이션을 위한 새로운 Python 표준인 ASGI_에 대한 배포도 지원합니다. Django의 :djadmin:’start project’ 관리 명령은 프로젝트에 필요한 대로 수정할 수 있는 기본 ASGI 구성을 설정하고 ASGI 호환…","html":"<h1>ASGI를 사용하여 배포하는 방법<a class=\"heading-anchor\" href=\"#how-to-deploy-with-asgi\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>WSGI뿐만 아니라, Django는 비동기 웹 서버와 애플리케이션을 위한 새로운 Python 표준인 ASGI_에 대한 배포도 지원합니다.</p>\n<p>Django의 :djadmin:’start project’ 관리 명령은 프로젝트에 필요한 대로 수정할 수 있는 기본 ASGI 구성을 설정하고 ASGI 호환 애플리케이션 서버를 사용하도록 지시합니다.</p>\n<p>Django에는 다음 ASGI 서버에 대한 시작 설명서가 포함되어 있습니다.</p>\n<div class=\"toctree-wrapper compound\">\n<ul>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/ko/3.2/howto/deployment/asgi/daphne/\">다프네와 함께 django를 사용하는 방법</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/ko/3.2/howto/deployment/asgi/hypercorn/\">하이퍼콘과 함께 짱고를 사용하는 방법</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/ko/3.2/howto/deployment/asgi/uvicorn/\">django와 유비콘 사용방법</a></li>\n</ul>\n</div>\n<section id=\"the-application-object\">\n<h2>애플리케이션 객체<a class=\"heading-anchor\" href=\"#the-application-object\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>WSGI와 마찬가지로 ASGI는 애플리케이션 서버가 코드와 통신하기 위해 사용하는 “애플리케이션” 호출 케이블을 제공합니다. 그것은 일반적으로 서버가 접근할 수 있는 파이썬 모듈에서 “애플리케이션”이라는 이름의 객체로 제공된다.</p>\n<p>:djadmin:’start project’ 명령은 :file:’/asgi 파일을 생성합니다.그러한 <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>응용프로그램”을 포함한 py는 호출할 수 있다.</p>\n<p>개발 서버(‘runserver’)에서 사용하는 것이 아니라 ASGI 서버가 개발 또는 프로덕션에서 사용할 수 있습니다.</p>\n<p>ASGI 서버는 대개 문자열로 호출할 수 있는 응용 프로그램의 경로를 택하는데 대부분의 Django 프로젝트에서 이것은 <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>my project.asgi: application”처럼 보일 것이다.</p>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">경고</p>\n<p>Django의 기본 ASGI 처리기는 모든 코드를 동기 스레드에서 실행하지만, 자신의 비동기 처리기를 실행하도록 선택하는 경우에는 비동기 안전성을 알고 있어야 합니다.</p>\n<p>어떤 비동기 코드에서도 동기 함수나 라이브러리 차단을 호출하지 마십시오. Django는 비동기식 안전이 아닌 Django 부분에서는 이 작업을 수행할 수 없도록 방지하지만 타사 앱이나 Python 라이브러리에서는 그렇지 않을 수 있습니다.</p>\n</aside>\n</section>\n<section id=\"configuring-the-settings-module\">\n<h2>설정 모듈 구성<a class=\"heading-anchor\" href=\"#configuring-the-settings-module\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>ASGI 서버가 응용프로그램을 로드할 때 Django는 전체 응용프로그램이 정의된 설정 모듈을 가져와야 합니다.</p>\n<p>Django는 :envvar를 사용합니다.’DJANGO_SETTINGS_MODULE’ 환경변수로서 적절한 설정모듈을 찾을 수 있다. 설정 모듈에 대한 점선 경로를 포함해야 합니다. 개발 및 프로덕션에 다른 값을 사용할 수 있습니다. 모든 값은 설정을 구성하는 방법에 따라 다릅니다.</p>\n<p>이 변수가 설정되지 않은 경우 기본값:<a class=\"reference external\" href=\"file:'asgi\">file:’asgi</a>’입니다.py는 그것을 <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>내 사이트”로 설정한다.”내 사이트”가 프로젝트의 이름인 설정”입니다.</p>\n</section>\n<section id=\"applying-asgi-middleware\">\n<h2>ASGI 미들웨어 적용<a class=\"heading-anchor\" href=\"#applying-asgi-middleware\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>ASGI 미들웨어를 적용하거나 Django를 다른 ASGI 애플리케이션에 포함시키려면 Django의 <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>응용” 개체를 “asgi”에 포장하면 된다.파이브 파일 예:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</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=\"Code code\"><code><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">some_asgi_library</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">AmazingMiddleware</span>\n<span class=\"n\">application</span> <span class=\"o\">=</span> <span class=\"n\">AmazingMiddleware</span><span class=\"p\">(</span><span class=\"n\">application</span><span class=\"p\">)</span>\n</code></pre></div>\n</section>","rootId":"how-to-deploy-with-asgi","toc":[{"title":"애플리케이션 객체","anchor":"the-application-object","children":[]},{"title":"설정 모듈 구성","anchor":"configuring-the-settings-module","children":[]},{"title":"ASGI 미들웨어 적용","anchor":"applying-asgi-middleware","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"“How-to” 가이드","url":"/ko/3.2/howto/"},{"docname":"howto/deployment/index","title":"Django 배포하기","url":"/ko/3.2/howto/deployment/"}],"prev":{"docname":"howto/deployment/wsgi/apache-auth","title":"Apache에서 Django의 사용자 데이터베이스에 대해 인증","url":"/ko/3.2/howto/deployment/wsgi/apache-auth/"},"next":{"docname":"howto/deployment/asgi/daphne","title":"다프네와 함께 django를 사용하는 방법","url":"/ko/3.2/howto/deployment/asgi/daphne/"},"formats":{"html":"/ko/3.2/howto/deployment/asgi/","markdown":"/ko/3.2/howto/deployment/asgi.md","json":"/ko/3.2/howto/deployment/asgi.json"},"source":"https://github.com/django/django/blob/stable/3.2.x/docs/howto/deployment/asgi/index.txt","official":"https://docs.djangoproject.com/ko/3.2/howto/deployment/asgi/","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","it","pt-br","ko","es","el","pl"]}