What does “app.run(host='0.0.0.0') ” mean in Flask [duplicate]

房东的猫 提交于 2019-12-03 09:08:21

问题


I am reading the Flask documentation. I was told that with app.run(host='0.0.0.0'), I could make the server publicly available.

What does it mean ? How can I visit the server in another computer (just localhost:5000 in my own computer) ?


回答1:


To answer to your second question. You can just hit the IP address of the machine that your flask app is running, e.g. 192.168.1.100 in a browser on different machine on the same network and you are there. Though, you will not be able to access it if you are on a different network. Firewalls or VLans can cause you problems with reaching your application. If that computer has a public IP, then you can hit that IP from anywhere on the planet and you will be able to reach the app. Usually this might impose some configuration, since most of the public servers are behind some sort of router or firewall.



来源:https://stackoverflow.com/questions/31904761/what-does-app-runhost-0-0-0-0-mean-in-flask

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!