mirror of https://github.com/zulip/zulip.git
settings: Allow customization of STATIC_URL.
Some requests will still be to `/static/`, either at the realm's domain, or at the root domain.
This commit is contained in:
parent
dd21e472e7
commit
3559bf416d
|
@ -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 None
|
||||
split_url = urllib.parse.urlsplit(url)
|
||||
split_static_url = urllib.parse.urlsplit(settings.STATIC_URL)
|
||||
|
||||
|
|
|
@ -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 None
|
||||
LOCAL_FILES_DIR = os.path.join(LOCAL_UPLOADS_DIR, "files") if LOCAL_UPLOADS_DIR else None
|
||||
|
|
|
@ -19,6 +19,8 @@ DEBUG = DEVELOPMENT
|
|||
|
||||
EXTERNAL_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.
|
||||
|
|
|
@ -116,6 +116,7 @@ else:
|
|||
response["Access-Control-Allow-Origin"] = "*"
|
||||
return response
|
||||
|
||||
assert settings.STATIC_URL is not None
|
||||
urls += static(urlsplit(settings.STATIC_URL).path, view=serve_static)
|
||||
|
||||
i18n_urls = [
|
||||
|
|
Loading…
Reference in New Issue