无法为 Flask 应用程序打开 url
Unable to open url for flask application
我使用虚拟框安装了 MapR 沙盒。从腻子我已经连接了安装在centos中的mapr沙箱。在这个系统中开发了一个烧瓶应用程序和 运行 它。在终端中显示
Running on http://127.0.0.1:5000/
但是当我出来的时候如果沙箱打开上面url它显示这个网站无法访问
我们可以 运行 在沙箱中开发的沙箱外应用程序吗?如果是,那么我如何打开上面的 url?
我可以看到来自 mapr 运行ning 的 hbase 网络 url。
默认情况下,您的 Web 服务器仅在您当前的计算机(即沙箱中的虚拟计算机)上可见。如果想在沙箱外访问,需要编辑host:
if __name__ == '__main__':
app.run(host='0.0.0.0')
或:
flask run host=0.0.0.0
然后前往http://<your virtual os's public IP>:5000/
这是文档表格 Quick Start
Externally Visible Server
If you run the server you will notice that the server is only accessible from your own computer, not from any other in the network. This is the default because in debugging mode a user of the application can execute arbitrary Python code on your computer.
If you have the debugger disabled or trust the users on your network, you can make the server publicly available simply by adding --host=0.0.0.0 to the command line:
flask run --host=0.0.0.0
This tells your operating system to listen on all public IPs.
我使用虚拟框安装了 MapR 沙盒。从腻子我已经连接了安装在centos中的mapr沙箱。在这个系统中开发了一个烧瓶应用程序和 运行 它。在终端中显示
Running on http://127.0.0.1:5000/
但是当我出来的时候如果沙箱打开上面url它显示这个网站无法访问
我们可以 运行 在沙箱中开发的沙箱外应用程序吗?如果是,那么我如何打开上面的 url?
我可以看到来自 mapr 运行ning 的 hbase 网络 url。
默认情况下,您的 Web 服务器仅在您当前的计算机(即沙箱中的虚拟计算机)上可见。如果想在沙箱外访问,需要编辑host:
if __name__ == '__main__':
app.run(host='0.0.0.0')
或:
flask run host=0.0.0.0
然后前往http://<your virtual os's public IP>:5000/
这是文档表格 Quick Start
Externally Visible Server If you run the server you will notice that the server is only accessible from your own computer, not from any other in the network. This is the default because in debugging mode a user of the application can execute arbitrary Python code on your computer.
If you have the debugger disabled or trust the users on your network, you can make the server publicly available simply by adding --host=0.0.0.0 to the command line:
flask run --host=0.0.0.0
This tells your operating system to listen on all public IPs.