问题
The Flask docs describe an externally visible server that allows users on your network to access your running app. The docs seem to assume a level of understanding that I don't possess and I can't figure out how to make it work.
I've adjusted my app.run()
method, passing it the host='0.0.0.0'
argument, as instructed in the docs.
How does a user in my network access my app? What address do they visit? Do other settings need to be configured?
回答1:
You should be able to access it by going to: 0.0.0.0:port
.
Someone on your network can access it by going to your-local-ip:port
.
Depending on your system, there is a way of finding your local IP address, but it should look something like 192.168.X.X
.
来源:https://stackoverflow.com/questions/18793115/flask-externally-visible-dev-server