File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,3 +208,6 @@ test-logs.txt
208208smoke-logs.txt
209209extract_links.py.py
210210extract_links.py
211+
212+ # Large static images
213+ static /static-large /*
Original file line number Diff line number Diff line change 1+ from django import template
2+ from django .conf import settings
3+
4+ register = template .Library ()
5+
6+
7+ @register .simple_tag
8+ def large_static (file_path : str ):
9+ # Strip any leading slashes to avoid footguns
10+ file_path = file_path .lstrip ("/" )
11+ if settings .LOCAL_DEVELOPMENT :
12+ return f"{ settings .STATIC_URL } static-large/{ file_path } "
13+ else :
14+ return f"{ settings .STATIC_CONTENT_AWS_S3_ENDPOINT_URL } /{ settings .STATIC_CONTENT_BUCKET_NAME } /static/{ file_path } "
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ set dotenv-load := false
22COMPOSE_FILE := " docker-compose.yml"
33ENV_FILE := " .env"
44DJANGO_VERSION := " 5.2"
5+ VALID_BUCKETS := " boost.org.v2 stage.boost.org.v2 boost.org-cppal-dev-v2"
6+
57
68@_ default :
79 just --list
@@ -180,3 +182,12 @@ alias shell := console
180182
181183@ manage + args :
182184 docker compose run --rm web python manage.py {{ args }}
185+
186+ # Static File Management
187+ @ down_sync_images BUCKET = ' stage.boost.org.v2': ## syncs all items from specified bucket to static /static-large for local development
188+ if echo {{ VALID_BUCKETS}} | grep -q -w ' {{ BUCKET}} ' ; then \
189+ aws s3 sync s3:// {{ BUCKET}} / static/ static/ static-large/ ; \
190+ echo " All missing or outdated static items synced." ; \
191+ else \
192+ echo " Bucket name invalid." ; \
193+ fi
Original file line number Diff line number Diff line change @@ -721,6 +721,17 @@ <h3>{{ section_title }}</h3>
721721 </ div >
722722 {% endwith %}
723723
724+ {% with section_title="Image Handling Example" %}
725+ {% load custom_static %}
726+ < div class ="v3-examples-section__block " id ="{{ section_title|slugify }} ">
727+ < h3 > {{ section_title }}</ h3 >
728+ < div class ="v3-examples-section__example-box ">
729+ {% large_static '/img/v3/learn-page/Learn_Octopus.png' as img_url %}
730+ < img src ="{{img_url}} " />
731+ </ div >
732+ </ div >
733+ {% endwith %}
734+
724735 {% comment %}
725736 Position Fixed dark mode toggle for quick theme switching without scrolling to the header.
726737 {% endcomment %}
You can’t perform that action at this time.
0 commit comments