I'm using Flask on Windows 7. Flask and related versions are below:
Flask==0.10.1
Werkzeug==0.9.3
Accessing the app from the same computer is OK using http://127.0.0.1:5000
However from another computer in LAN the access fails: http://192.168.101.103:5000
I start the app with these parameters:
#app.py
if __name__ == '__main__':
app.run( host='0.0.0.0:5000')
One thing I don't understand is, when I start netcat on the same computer, where Flask is currently listening on the same port, it works, and netcat is even accessible from another computer:
>c:\Python27\python manage.py runserver
>
* Running on http://127.0.0.1:5000/
* Restarting with reloader
works ...
>nc -l -p 5000
works on the same computer, same port ???
GET / HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: de-DE
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0;
Accept-Encoding: gzip, deflate
Host: 192.168.101.103:5000
DNT: 1
Connection: Keep-Alive
even accepting connection from another computer ???
So beside the obvious question, how to get Flask serving for LAN, I'm curious, how could two processes of one machine listen on the same port?
Thank you!
if __name__ == '__main__':
and got the error onapp.run( host="0.0.0.0:5000")
Now it works, but have strange start/stop behavior. Sometimes on restart it Flask though binds to 127.0.0.1. I think I have to go for nginx as the proxy server for the Flask for serving in LAN – Halley