【发布时间】:2021-06-12 14:45:39
【问题描述】:
我正在尝试使用 selenium 编写测试,并且正在使用 ChannelsLiveServerTestCase。 我需要设置服务器监听的端口。
【问题讨论】:
标签: django-channels
我正在尝试使用 selenium 编写测试,并且正在使用 ChannelsLiveServerTestCase。 我需要设置服务器监听的端口。
【问题讨论】:
标签: django-channels
我想这应该是一种罕见的情况,有人需要设置端口,因为没有人回答这个问题。 无论如何,我不得不深入研究达芙妮的源代码。 在 testing.py 文件中查找该行
endpoints = build_endpoint_description_strings(host=self.host, port=0)
在我的情况下,它是第 139 行并将其更改为
endpoints = build_endpoint_description_strings(host=self.host, port=WHICHEVER_PORT_YOU_WANT)
【讨论】: