Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Allow customization of STATIC_URL.
Alex Vandiver3559bf416d65
diff --git a/zerver/lib/subdomains.py b/zerver/lib/subdomains.pyindex aa3a8f6ef09..c583a2af4b1 100644--- a/zerver/lib/subdomains.py+++ b/zerver/lib/subdomains.py@@ -56,6 +56,7 @@ def is_root_domain_available() -> bool:def is_static_or_current_realm_url(url: str, realm: Optional[Realm]) -> bool:+ assert settings.STATIC_URL is not Nonesplit_url = urllib.parse.urlsplit(url)split_static_url = urllib.parse.urlsplit(settings.STATIC_URL)diff --git a/zproject/computed_settings.py b/zproject/computed_settings.pyindex e970abc0a5f..ba3f369308a 100644--- a/zproject/computed_settings.py+++ b/zproject/computed_settings.py@@ -60,6 +60,7 @@ from .configured_settings import (SOCIAL_AUTH_SAML_ENABLED_IDPS,SOCIAL_AUTH_SAML_SECURITY_CONFIG,SOCIAL_AUTH_SUBDOMAIN,+ STATIC_URL,STATSD_HOST,TORNADO_PORTS,USING_PGROONGA,@@ -537,10 +538,11 @@ CAMO_KEY = get_secret("camo_key") if CAMO_URI != "" else None# STATIC CONTENT AND MINIFICATION SETTINGS########################################################################-if PRODUCTION or IS_DEV_DROPLET or os.getenv("EXTERNAL_HOST") is not None:- STATIC_URL = urljoin(ROOT_DOMAIN_URI, "/static/")-else:- STATIC_URL = "http://localhost:9991/static/"+if STATIC_URL is None:+ if PRODUCTION or IS_DEV_DROPLET or os.getenv("EXTERNAL_HOST") is not None:+ STATIC_URL = urljoin(ROOT_DOMAIN_URI, "/static/")+ else:+ STATIC_URL = "http://localhost:9991/static/"LOCAL_AVATARS_DIR = os.path.join(LOCAL_UPLOADS_DIR, "avatars") if LOCAL_UPLOADS_DIR else NoneLOCAL_FILES_DIR = os.path.join(LOCAL_UPLOADS_DIR, "files") if LOCAL_UPLOADS_DIR else Nonediff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex 14c73fa8cbd..9d5f9fb2c2f 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -19,6 +19,8 @@ DEBUG = DEVELOPMENTEXTERNAL_HOST_WITHOUT_PORT = deport(EXTERNAL_HOST)+STATIC_URL: Optional[str] = None+# These settings are intended for the server admin to set. We document them in# prod_settings_template.py, and in the initial /etc/zulip/settings.py on a new# install of the Zulip server.diff --git a/zproject/dev_urls.py b/zproject/dev_urls.pyindex 77c487be12f..281250fb607 100644--- a/zproject/dev_urls.py+++ b/zproject/dev_urls.py@@ -116,6 +116,7 @@ else:response["Access-Control-Allow-Origin"] = "*"return response+ assert settings.STATIC_URL is not Noneurls += static(urlsplit(settings.STATIC_URL).path, view=serve_static)i18n_urls = [