django 中使用request请求失败,requests.exceptions.ConnectionError: HTTPConnectionPool(host='xxx', port=80):

记录下今天遇到的问题:

本地在使用request请求接口的时候,没有问题

但是代码部署在服务器上之后,请求失败,错误:requests.exceptions.ConnectionError: HTTPConnectionPool(host='xxxxx', port=80): Max retries exceeded with url: /backend-api/api-user/login (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001D0F70E85C0>

原因:服务器host错误,导致连接不上目标服务器,提示这个错误

原文地址:https://www.cnblogs.com/jueshilaozhongyi/p/13354454.html