mirror of https://github.com/pallets/flask.git
The default run method is now accepting the port from the SERVER_NAME.
This commit is contained in:
parent
05479eb954
commit
62dbe0e1ca
2
CHANGES
2
CHANGES
|
@ -71,6 +71,8 @@ Release date to be decided.
|
|||
- Flask now orders JSON keys by default to not trash HTTP caches due to
|
||||
different hash seeds between different workers.
|
||||
- Added `appcontext_pushed` and `appcontext_popped` signals.
|
||||
- The builtin run method now takes the ``SERVER_NAME`` into account when
|
||||
picking the default port to run on.
|
||||
|
||||
Version 0.9
|
||||
-----------
|
||||
|
|
11
flask/app.py
11
flask/app.py
|
@ -739,10 +739,15 @@ class Flask(_PackageBoundObject):
|
|||
won't catch any exceptions because there won't be any to
|
||||
catch.
|
||||
|
||||
.. versionchanged:: 0.10
|
||||
The default port is now picked from the ``SEVER_NAME`` variable.
|
||||
|
||||
:param host: the hostname to listen on. Set this to ``'0.0.0.0'`` to
|
||||
have the server available externally as well. Defaults to
|
||||
``'127.0.0.1'``.
|
||||
:param port: the port of the webserver. Defaults to ``5000``.
|
||||
:param port: the port of the webserver. Defaults to ``5000`` or the
|
||||
port defined in the ``SERVER_NAME`` config variable if
|
||||
present.
|
||||
:param debug: if given, enable or disable debug mode.
|
||||
See :attr:`debug`.
|
||||
:param options: the options to be forwarded to the underlying
|
||||
|
@ -754,6 +759,10 @@ class Flask(_PackageBoundObject):
|
|||
if host is None:
|
||||
host = '127.0.0.1'
|
||||
if port is None:
|
||||
server_name = self.config['SERVER_NAME']
|
||||
if server_name and ':' in server_name:
|
||||
port = int(server_name.rsplit(':', 1)[1])
|
||||
else:
|
||||
port = 5000
|
||||
if debug is not None:
|
||||
self.debug = bool(debug)
|
||||
|
|
Loading…
Reference in New Issue