From 0a118924147667ea26e7d6a4806a206a5516a68a Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Thu, 25 May 2023 18:23:18 -0400 Subject: [PATCH] chore: use variable for static.ietf.org references (#5692) --- .devcontainer/devcontainer.json | 6 +++++- docker-compose.yml | 6 ++++++ docker/configs/settings_local.py | 2 ++ ietf/doc/models.py | 2 +- ietf/settings.py | 3 ++- ietf/templates/base.html | 4 ++-- ietf/templates/doc/document_html.html | 4 ++-- 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c4f2ee172..5fd3fb2be 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -66,7 +66,7 @@ }, // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [8000, 5432, 5433], + "forwardPorts": [3000, 5432, 5433, 8000, 8001], "portsAttributes": { "3000": { @@ -84,6 +84,10 @@ "8000": { "label": "Datatracker", "onAutoForward": "notify" + }, + "8001": { + "label": "Static", + "onAutoForward": "silent" } }, diff --git a/docker-compose.yml b/docker-compose.yml index e91085266..434ec8f46 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,6 +59,12 @@ services: volumes: - ./docker/configs/pgadmin-servers.json:/pgadmin4/servers.json + static: + image: ghcr.io/ietf-tools/static:latest + restart: unless-stopped + ports: + - 8001:80 + mq: image: rabbitmq:3-alpine restart: unless-stopped diff --git a/docker/configs/settings_local.py b/docker/configs/settings_local.py index a405206c9..4f0d6a249 100644 --- a/docker/configs/settings_local.py +++ b/docker/configs/settings_local.py @@ -55,3 +55,5 @@ NOMCOM_PUBLIC_KEYS_DIR = 'data/nomcom_keys/public_keys/' SLIDE_STAGING_PATH = 'test/staging/' DE_GFM_BINARY = '/usr/local/bin/de-gfm' + +STATIC_IETF_ORG = "http://localhost:8001" diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 8779ffb2a..5d0e22683 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -627,7 +627,7 @@ class DocumentInfo(models.Model): stylesheets.append(finders.find("ietf/css/document_html_txt.css")) else: text = self.htmlized() - stylesheets.append("https://static.ietf.org/fonts/noto-sans-mono/import.css") + stylesheets.append(f'{settings.STATIC_IETF_ORG}/fonts/noto-sans-mono/import.css') cache = caches["pdfized"] cache_key = name.split(".")[0] diff --git a/ietf/settings.py b/ietf/settings.py index 7934a42a7..db3acab1e 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -137,7 +137,6 @@ IETF_NOTES_URL = 'https://notes.ietf.org/' # HedgeDoc base URL # Absolute path to the directory static files should be collected to. # Example: "/var/www/example.com/static/" - SERVE_CDN_PHOTOS = True SERVE_CDN_FILES_LOCALLY_IN_DEV_MODE = True @@ -157,6 +156,8 @@ STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ) +STATIC_IETF_ORG = "https://static.ietf.org" + WSGI_APPLICATION = "ietf.wsgi.application" AUTHENTICATION_BACKENDS = ( 'ietf.ietfauth.backends.CaseInsensitiveModelBackend', ) diff --git a/ietf/templates/base.html b/ietf/templates/base.html index c5dd43fef..dd8a49158 100644 --- a/ietf/templates/base.html +++ b/ietf/templates/base.html @@ -15,8 +15,8 @@ {% block title %}No title{% endblock %} - - + +