- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的项目中使用 django channel ,使用官方 django channels v2
,如果运行 python manage.py runserver
,我的简单 channel 应用程序已完成并且可以正常工作
但
我想在不同的端口运行 django channel ,所以我现在使用 daphne
使用 daphne
my_project.asgi:application --port 8001
它在 8001 端口工作正常
INFO Starting server at tcp:port=8001:interface=127.0.0.1
INFO HTTP/2 support not enabled (install the http2 and tls Twisted extras)
python manage.py runserver
在另一个终端并行工作正常。现在我的两个 channel 都在
8001
和 Django 在
8000
端口工作正常,但我的 runserver 命令运行 ASGI/Channels 而不是 wsgi 开发服务器,
Starting ASGI/Channels version 2.2.0 development server at http://127.0.0.1:8000/
Starting development server at http://127.0.0.1:8000/
ASGI_APPLICATION = 'my_project.routing.application'
WSGI_APPLICATION = 'my_project.wsgi.application'
views.py
中调试任何函数请求,它是 ASGI 请求而不是 django wsgi 请求
asgi.py
import os
import django
from channels.routing import get_default_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_project.settings")
django.setup()
application = get_default_application()
def index(request)
)中获取 django 请求而不是 ASGI 请求,或者如果我们安装 django channel ,每个请求都成为 ASGI 请求? 最佳答案
喜欢你可以在这里阅读:https://asgi.readthedocs.io/en/latest/
ASGI (Asynchronous Server Gateway Interface) is a spiritual successor to WSGI, intended to provide a standard interface between async-capable Python web servers, frameworks, and applications.
Where WSGI provided a standard for synchronous Python apps, ASGI provides one for both asynchronous and synchronous apps, with a WSGI backwards-compatibility implementation and multiple servers and application frameworks.
Yes, all requests will be ASGI
.
关于django - 如何在 django channel 的 daphne ASGI 一侧运行 wsgi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57801016/
这可能是一个愚蠢的问题,但是要求图中顶点的最小集合的规范问题是什么,以便从这些顶点开始,所有其他顶点都可以通过“旅行”不超过一条边到达? 现实生活中的应用是:我需要认识哪些人,才能与地球上的其他人仅通
当浏览器在伪元素溢出并导致问题后调整绝对定位大小时。我正在寻找解决此问题的方法。只需调整浏览器大小,直到出现标题文本。 这是问题的演示:http://codepen.io/anon/pen/grKNo
我编写的 java 应用程序遇到了导致硬件性能问题的问题。问题(我相当确定)是我运行该应用程序的一些机器只有 1GB 内存。当我启动 java 应用程序时,我将堆大小设置为 -Xms 512m -Xm
Article 与 Medium 具有单向 ManyToOne 关系,它与下面的代码配合良好:保存和删除文章成功。 我想知道 JPA 是否有一种优雅的方式来删除最后一个子实体(在本例中为medium)
我想弄清楚如何在我的预约表格中将医生列表作为radio_buttons。现在,如果我使用“f.input :physician_id, :as => :radio_buttons”,我会得到一个“是/
我是一名优秀的程序员,十分优秀!