【问题标题】:How to set the django-channels ChannelsLiveServerTestCase server port?如何设置 django-channels ChannelsLiveServerTestCase 服务器端口?
【发布时间】:2021-06-12 14:45:39
【问题描述】:

我正在尝试使用 selenium 编写测试,并且正在使用 ChannelsLiveServerTestCase。 我需要设置服务器监听的端口。

【问题讨论】:

    标签: django-channels


    【解决方案1】:

    我想这应该是一种罕见的情况,有人需要设置端口,因为没有人回答这个问题。 无论如何,我不得不深入研究达芙妮的源代码。 在 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)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-09
      • 1970-01-01
      • 2020-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多