【发布时间】:2023-03-27 14:51:01
【问题描述】:
我有 django (1.6) 应用程序,我想用 locust 测试它。
我安装了locust==0.7.5 和pyzmq==16.0.2 并恢复了很多失败:[Errno 111] Connection refused' 更多详细信息如下
当我使用命令运行应用程序时:locust --host=http://127.0.0.1 我收到以下错误:
ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f7639d89750>: Failed to establish a new connection: [Errno 111] Connection refused',))",),)
我的蝗虫档案:
from locust import TaskSet, HttpLocust, task
class UserBehavior(TaskSet):
@task
def home(self):
self.client.get('/')
@task
def programm(self):
self.client.get('/programm')
class WebsiteUser(HttpLocust):
task_set = UserBehavior
任何有关如何解决错误的帮助将不胜感激!
【问题讨论】:
-
你确定你的应用在 80 端口上运行吗?
-
@FernandoCezar 我在 127.0.0.1:8000 上运行我的应用程序
-
但是你的 locust 正在尝试连接到端口 80,而不是 8000:
ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=80) -
@FernandoCezar 我明白,但我该如何更改?