繁体   English   中英

如何从 Amazon EC2 实例的浏览器访问在我的本地系统上运行的 Flask API?

[英]How to access the Flask API running on my local system, from the browser of an Amazon EC2 instance?

如何从 Amazon EC2 实例的浏览器访问在本地系统上运行的 Flask API?

如果我的 Flask API 的(简化)代码是:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
  return 'Hello world!' 

if __name__ == '__main__':
    app.debug = True
    app.run(host='0.0.0.0')

I can access the Flask API using another machine connected to my same network by typing in the browser search bar http://[ip]:5000/ , where [ip] is the IP address of the computer the Flask API is running on.

我认为用 EC2 实例的 IP 地址替换我的机器的 IP 地址是不够的,但是有人对如何做到这一点有任何建议吗?

如果我误用了某些术语,我深表歉意,但我最近一直在研究这个话题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM