Flask, cannot assign requested address [duplicate] Flask, cannot assign requested address [duplicate] flask flask

Flask, cannot assign requested address [duplicate]


You can only directly bind to an IP address that the server has been configured for; behind a router running Network Address Translation (NAT) your internal IP address will be different.

Either bind directly to that internal IP address, or use '0.0.0.0' to listen on all interfaces. You may still need to configure the router to forward a specific port to your internal server.


The IP you want to bind a socket to must be directly available on an interface of the machine. This seems not be the case here.

  • If you're behind a NAT: use port-forwarding
  • If you're using a VPN and the VPN adapter of the server is not always up, try using "0.0.0.0" as an address. Beware: It will listen on all interfaces available. Create firewall rules to block access via interfaces you don't want to listen to when using this.