使用蝗虫和 [Errno 111] 连接被拒绝进行测试
Test with locust and [Errno 111] Connection refused
我有 django (1.6) 应用程序,我想用蝗虫对其进行测试。
我安装了 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',))",),)
我的locust文件:
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
任何关于如何解决错误的帮助将不胜感激!
由于您的服务器 运行 在端口 8000 而不是 80 上,请尝试 运行 命令
locust --host=http://127.0.0.1:8000 -f <your-locust-file.py>
像 192.168.1.1:8080/api/
这样使用您的本地 IP 地址。本地主机抛出连接被拒绝。
我有 django (1.6) 应用程序,我想用蝗虫对其进行测试。
我安装了 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',))",),)
我的locust文件:
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
任何关于如何解决错误的帮助将不胜感激!
由于您的服务器 运行 在端口 8000 而不是 80 上,请尝试 运行 命令
locust --host=http://127.0.0.1:8000 -f <your-locust-file.py>
像 192.168.1.1:8080/api/
这样使用您的本地 IP 地址。本地主机抛出连接被拒绝。