【发布时间】:2020-10-14 15:37:13
【问题描述】:
我正在运行特定配置。我让 django 在地址 localhost:8001 上的 apache 上运行,而 react app 在 localhost:8005 上的 nginx 上运行。我也使用 ngingx 来路由代理。我最大的问题是当我尝试通过 React 调用 DRF API 时(调用 http://127.0.0.1:8001/api-token-auth/ 所以我肯定在端点的末尾得到了/)我得到了POST http://127.0.0.1:8001/api-token-auth/ net::ERR_CONNECTION_REFUSED
后端运行良好,我可以使用 HTTPie 或 POSTMAN 的端点 当我在 React 中通过外部域名调用后端时,例如“example.com/api-token-auth/”,它工作得很好。我该如何解决这个问题?
【问题讨论】:
标签: django reactjs apache http nginx