I followed the guide https://bottlepy.org/docs/dev/tutorial.html on Raspberry Pi with the following example
from bottle import route, run
@route('/hello')
def hello():
return "Hello World!"
run(host='0.0.0.0', port=81, debug=True)
Then I run the python script sudo python hello.py
The web page http://<IP address>:81
is not available,
where <IP address>
is the IP address of the raspberrry pi.
Running sudo netstat --tcp --udp --listening --program
I obtain
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 < IP address >:81 *:* LISTEN 26308/python`
iptable is blocking incoming traffic on port 81.
It works after the command sudo iptables -A INPUT -p tcp --dport 81 -j ACCEPT