django 如何同时与 websocket server 和 webserver 一起工作?

How does django work with websocket server and webserver simultaneously?

我觉得我对websocket server和webserver的理解有些混乱

所以我遵循了 django 频道的教程,在那里我创建了一个小应用程序来监听频道并 returns 一些响应。

与此同时,我仍然可以提供具有正常视图功能的网页,那么 django 是如何做到这一点的,它可以在我不修改 nginx 服务器配置的情况下工作?

documentation 提到了它是如何工作的:

It separates Django into two process types:

One that handles HTTP and WebSockets

One that runs views, websocket handlers and background tasks (consumers) They communicate via a protocol called ASGI, which is similar to WSGI but runs over a network and allows for more protocol types. [...] probably Daphne