-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use SERVER_NAME to set host and port in app.run() #2152
Conversation
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.
_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? |
_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... |
|
||
_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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
(Of course, I did say LGTM when it was broken, so take my review with a grain of salt)
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