Skip to content
Myr

use SERVER_NAME to set host and port in app.run() (#2152)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Raphael Deem · committed by David Lord · parent fe7910c · Browse files · 1 file+8 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−8 removed

  • other:+8 added−8 removed

1 file+8 added−8 removed

modified:flask/app.py+8 added-8 removed
823 unmodified lines
824 :func:`werkzeug.serving.run_simple` for more825 information.826 """827 from werkzeug.serving import run_simple828 if host is None:829 host = '127.0.0.1'830 if port is None:831 server_name = self.config['SERVER_NAME']832 if server_name and ':' in server_name:833 port = int(server_name.rsplit(':', 1)[1])834 else:835 port = 5000828 _host = '127.0.0.1'829 _port = 5000830 server_name = self.config.get("SERVER_NAME")831 sn_host, sn_port = None, None832 if server_name:833 sn_host, _, sn_port = server_name.partition(':')834 host = host or sn_host or _host835 port = int(port or sn_port or _port)836 if debug is not None:837 self.debug = bool(debug)838 options.setdefault('use_reloader', self.debug)839 options.setdefault('use_debugger', self.debug)
1161 unmodified lines