run-dev.py: Fix incorrectly printed hostname for droplets.

Because the logic in print_listeners doesn't have access to computed
settings in dev_settings.py, we need to duplicate the special
IS_DEV_DROPLET logic for computing the default hostname.

There's still a secondary problem that this URL 404s.
This commit is contained in:
Tim Abbott 2021-04-06 11:16:16 -07:00
parent 3c41db7f1a
commit e51344ab2d
2 changed files with 9 additions and 1 deletions

View File

@ -366,7 +366,14 @@ def shutdown_handler(*args: Any, **kwargs: Any) -> None:
def print_listeners() -> None:
external_host = os.getenv("EXTERNAL_HOST", f"localhost:{proxy_port}")
# Since we can't import settings from here, we duplicate some
# EXTERNAL_HOST logic from dev_settings.py.
IS_DEV_DROPLET = pwd.getpwuid(os.getuid()).pw_name == "zulipdev"
if IS_DEV_DROPLET:
default_hostname = os.uname()[1].lower()
else:
default_hostname = "localhost"
external_host = os.getenv("EXTERNAL_HOST", f"{default_hostname}:{proxy_port}")
print(f"\nStarting Zulip on:\n\n\t{CYAN}http://{external_host}/{ENDC}\n\nInternal ports:")
ports = [
(proxy_port, "Development server proxy (connect here)"),

View File

@ -23,6 +23,7 @@ external_host_env = os.getenv("EXTERNAL_HOST")
if external_host_env is None:
if IS_DEV_DROPLET:
# For our droplets, we use the hostname (eg github_username.zulipdev.org) by default.
# Note that this code is duplicated in run-dev.py.
EXTERNAL_HOST = os.uname()[1].lower() + ":9991"
else:
# For local development environments, we use localhost by