At this time, Flask.run() accepts only a host= parameter containing a single address. While :: for the Linux kernel also accepts IPv4-mapped IPv6 addresses from the ::ffff:0.0.0.0/96 range, other dual stack implementations, such as Windows (and OpenBSD I think) do not map IPv4 addresses into the IPv6 address space for (IMHO sound) security rationales.
Please support binding to multiple addresses, thus supporting dual stack deployment, such as host=('0.0.0.0', '::').
What's the point of this? The builtin server is just for development anyway.
This would be an issue with Werkzeug, not Flask. But yeah, don't really see why the dev server would need to bind multiple addresses.
@davidism Okay, so I'm looking into Werkzeug. Binding to multiple addresses is necessary, because you need to bind to IPv4 ANY separately from IPv6 ANY. Do you have any IPv6 and Dual Stack experience?
Can you please explain why you need dual stack in a server that is only suitable for development? It must not be used in production.
@ThiefMaster can you please explain why a dual stack server is for production only? I'm using it in a simulation environment inside lightweight docker containers, but need many instances of them in separate subnets. I'm running dual stack for a reason.
The dev server is for local development. For production, where it seems more likely you would need to bind to multiple addresses, use a production WSGI server. That includes within docker containers. See the deploying docs. uWSGI, gunicorn, and Nginx can all bind to multiple addresses.
Gevent looks like an option to me, as I need to keep resources low in the comtainers, because I run many of them in parallel.
davidism edit: It would be more useful to provide a concrete example where the dev server needs to support multiple binds. Evaluating the viability of a request is difficult without an example.
You are welcome to contribute dual-stack support to Werkzeug, if it's a well-made PR I'm sure we'll appreciate it. However, AFAIK you cannot bind a single listening socket to both IPv4 and IPv6 unless you bind to all IPs (HAProxy has an option for this ("v4v6")). And while I'm not extremely familiar with the dev server's internals it might add lots of complexity to the code if it suddenly needs to deal with multiple listening sockets.
BTW: If all you need is a pure-python server, you can also have a look at cherrypy's webserver. It's quite easy to run Flask (or any other) WSGI app inside it.