use SERVER_NAME to set host and port in app.run()#2152
use SERVER_NAME to set host and port in app.run()#2152davidism merged 5 commits intopallets:masterfrom
Conversation
flask/app.py
Outdated
| server_name = self.config.get("SERVER_NAME", None) | ||
| if server_name: | ||
| _host, _port = servername.split(':', 1) | ||
| host, port = host or _host, port or int(_port) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
flask/app.py
Outdated
| _port = 5000 | ||
| server_name = self.config.get("SERVER_NAME", None) | ||
| if server_name: | ||
| _host, _port = servername.split(':', 1) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Yikes, thanks @jeffwidman. Any pointers on tests we could write to catch some of these types of situations? |
flask/app.py
Outdated
| _port = 5000 | ||
| server_name = self.config.get("SERVER_NAME", None) | ||
| if server_name: | ||
| _host, _port = server_name.split(':', 1) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Is there a reason you didn't include the "set |
|
Posted this in the linked issue, but note that this won't and can't apply to the |
|
I haven't looked at the original issue in depth, but you got me curious on how to use @r0fls Feel free to use as much or as little of this as you want. I just really liked the clean/linear way your original implementation walked through the configs, so I'd hate to see your solution get too cluttered up... |
flask/app.py
Outdated
|
|
||
| _host = '127.0.0.1' | ||
| _port = 5000 | ||
| server_name = self.config.get("SERVER_NAME", None) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| server_name = self.config.get("SERVER_NAME") | ||
| if server_name: | ||
| sn_host, _, sn_port = server_name.partition(':') | ||
| host = host or sn_host or _host |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Should I rebase to 1 commit at this point, or does that not matter? |
|
Not sure why the Python 2.6 tests started failing, but it seems unrelated. |
|
Ya, it looks to be a message saying 2.6 is no longer supported or maintained by the core devs. |
|
That is true but Flask still supports it. However, it appears that coverage.py no longer does. |
|
This needs a testcase and changelog. |
|
Done. Re: 2.6, it was fixed in Coverage earlier today, tests pass again. https://coverage.readthedocs.io/en/coverage-4.3.4/changes.html#version-4-3-4-2017-01-17 |
|
@davidism I was wondering whether the docstring for the
|
|
That is probably a good idea, do you want to open a PR? |
Addresses #2109