diff --git a/tools/run-dev.py b/tools/run-dev.py index 195bdda5fd..8dc7f6dcab 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -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)"), diff --git a/zproject/dev_settings.py b/zproject/dev_settings.py index ad134dd6ed..d576a58c16 100644 --- a/zproject/dev_settings.py +++ b/zproject/dev_settings.py @@ -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