Get host public IPv6 Flask server address programmatically
12:25 21 Jun 2026

When I run Flask:

app.run(host="::", port=5000)  # :: binds to all IPv6 interfaces

I get this:

 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (::)
 * Running on http://[::1]:5000
 * Running on http://[3499:7010:bb23:4321:f1ce:c68e:698d:1234]:5000

Is there a Flask means to retrieve the public IPv6 listed on the last line, 3499:7010:bb23:4321:f1ce:c68e:698d:1234?

If not Flask, then what is the best way to do this?

I tried:

os.getenv("FLASK_RUN_HOST", "127.0.0.1")

and I just get the local net IPv4 address, 192.168.1.160.

python flask webserver ipv6