flask - Axios GET 请求到服务器 - 不是本地主机
问题描述
我想知道是否有人可以对 GET 请求路径的工作方式有所了解。我不擅长网络,所以在这里有点迷路。
我有一个在 PythonAnywhere 上运行的 Flask 应用程序......我用 Vue 构建了一个小应用程序,并正在使用 Axios 向服务器上的 API 发送 GET 请求。然而,我发现当我在 PythonAnywhere 服务器上运行我的应用程序时,只有当我也在本地机器上运行烧瓶应用程序时才会得到响应。我怀疑这是因为我试图将请求发送到http://localhost:5000/api/random2。真的吗?我必须用什么替换它才能将请求发送到我的 PythonAnywhere 应用程序?
getResults () {
const path = `http://localhost:5000/api/random2`
axios.get(path, {
params: {
p_a: this.p_a,
R_eH: this.R_eH,
a: this.a,
b: this.b
}
})
.then(response => {this.result = response.data})
.catch(error => {
console.log(error)
})
}
},
谢谢你,雅库布
解决方案
推荐阅读
- java - “TYPE_ACCESSIBILITY_OVERLAY”类型的叠加层隐藏了导航按钮
- spring-boot - 用于动态文件的嵌入式 H2 数据库
- amazon-redshift - 元数据库 - 如何从 queryHash 中查找问题 ID 或仪表板 ID
- javascript - 当我们在字段上应用格式化程序功能时,搜索功能不起作用
- elasticsearch - 使用 Watcher 和 Kibana 监控电子邮件日志,在最后一分钟内每分钟触发一次
- angular - 渲染后使用哪个 Angular 或 Ionic 生命周期钩子来获取元素的 offsetWidth
- dns - DNSBL 定义 IP 范围
- c# - 收到错误“请在调用此方法之前为当前资源定义接收(响应)队列”
- php - Laravel Blade 中为 foreach() 提供的参数无效。在 dd 正确的值
- c# - Linq 或 EF - 使用过滤属性多次加入非匿名对象