【发布时间】:2018-12-28 01:33:14
【问题描述】:
我们在 WSGI 模式下运行相同的 django 项目来处理 HTTP 请求,并在 ASGI 模式下处理 WebSockets。对于 WSGI 模式,我们使用 gunicorn3 服务器:
gunicorn3 --pythonpath . -b 0.0.0.0:8000 chat_bot.wsgi:application
对于 ASGI 模式,我们使用 daphne 服务器:
daphne --root-path . -b 0.0.0.0 -p 8001 chat_bot.asgi:application
如何以编程方式检测当前正在运行的模式是 GreenUnicorn+WSGI 还是 Daphne+ASGI?
【问题讨论】:
标签: django gunicorn wsgi django-channels