다프네와 함께 django를 사용하는 방법Link to this heading

Daphne is a pure-Python ASGI server for UNIX, maintained by members of the Django project. It acts as the reference server for ASGI.

다프네 설치Link to this heading

You can install Daphne with pip:

Shell
python -m pip install daphne

다프네에서 djagno 작동Link to this heading

다프네가 설치되면 다프네 서버 프로세스를 시작하는 ``다프네” 명령이 나온다. 간단히 말해, 다프네는 ASGI 애플리케이션 개체를 포함하는 모듈의 위치로 호출되어야 하며, 그 다음에 애플리케이션 이름이 콜론으로 구분됩니다.

For a typical Django project, invoking Daphne would look like:

Shell
daphne myproject.asgi:application

이로써 “127.0.0.1:8000”에 대한 청취가 시작된다. 프로젝트가 Python 경로에 있어야 합니다. ``관리”와 동일한 디렉토리에서 이 명령을 실행해야 합니다.

Integration with runserverLink to this heading

Daphne provides a runserver command to serve your site under ASGI during development.

This can be enabled by adding daphne to the start of your INSTALLED_APPS and adding an ASGI_APPLICATION setting pointing to your ASGI application object:

Code
INSTALLED_APPS = [
    "daphne",
    ...,
]

ASGI_APPLICATION = "myproject.asgi.application"