尝试在我的Windows 10上安装apache 2.4时遇到问题.它总是显示VCRUNTIME140.dll丢失的错误.我检查了其他线程,发现安装2015 Visual C++ Redistributables x64/x86总能解决问题,但我已经安装了,我仍然有这个问题.还有其他解决方案吗?
我有一个使用通道的项目,并且本地一切运行良好,但是当我部署在 Heroku 上时,每次尝试连接时都会收到 403 错误。起初我以为问题出在 Heroku 上,因为我在本地测试了它,甚至在本地使用了 Heroku 的数据库和 redis 实例,一切正常。
但后来,当我使用ngrok打开到本地主机的公共隧道时,我发现结果与 Heroku 中的结果相同。对于每个请求,我都会收到 403 并尝试调试它并没有多大帮助,因为事件循环有时会突然控制,或者我会收到超时错误。设置完全相同,只是一个是本地访问,另一个是远程访问。这就是我开始达芙妮的方式
daphne weout.asgi:application --port 8000 --bind 0.0.0.0 -v 3:
我的库版本:
将 Daphne 的详细程度设置为最大后,这就是我尝试连接时得到的结果:
Nov 22 07:16:34 weout-staging app/web.1 2019-11-22 15:16:33,489 [asyncio] DEBUG: poll 101.195 ms took 0.023 ms: 1 events
Nov 22 07:16:34 weout-staging app/web.1 10.12.43.130:10299 - - [22/Nov/2019:15:16:33] "WSCONNECTING /api/v1/ws/" - -
Nov 22 07:16:34 weout-staging app/web.1 2019-11-22 15:16:33,513 [daphne.http_protocol] DEBUG: Upgraded connection ['10.x.x.x', 10299] to WebSocket …Run Code Online (Sandbox Code Playgroud) 我似乎无法解决这个问题。我正在按照文档中的描述为我的频道消费者编写测试。我通常使用 Django 默认的 unittest,但由于 Channels 需要使用 pytest,我正在使用它,但仍然希望保持编写测试的类结构。
我在编写类似于 unittest 的设置方法时遇到了问题,我会用它来初始化测试属性。我尝试了使用autouse=true 的方法装置、类装置,但它们似乎都不起作用,因为我无法访问测试方法中的实例属性。最后我只是决定编写实例方法并为每个类手动调用它。这是我到目前为止:set_up
@pytest.mark.django_db
@pytest.mark.asyncio
class TestChatConsumer(object):
@database_sync_to_async
def set_up(self):
self.user = UserFactory()
self.api_client = APIClientFactory()
self.token = TokenFactory(user=self.user)
self.credentials = {
'AUTHORIZATION': self.token.key,
...
}
self.credentials_params = '&'.join(['{}={}'.format(k, v) for k, v in self.credentials.items()])
self.authless_endpoint = '/api/v1/ws/'
self.endpoint = self.authless_endpoint + '?' + self.credentials_params
async def test_connect_without_credentials(self):
await self.set_up()
communicator = WebsocketCommunicator(application, self.authless_endpoint)
connected, subprotocol = await communicator.connect()
assert not connected
async def …Run Code Online (Sandbox Code Playgroud)