I am facing a simple issue that I cannot seem to resolve. I have configured Django storages to serve static files from S3. In my template, I define the image source like this:
"{% static 'fun_share/img/logo/logo.svg' %}"
with
STATIC_URL = "/static/"
Django storages handles the actual translation of the img src, resulting in . So far so good.
Now, I want to change the image src from plain javascript to a different image (logo-2.svg).
What is the best approach to accessing the s3 bucket with the correct URL (taking into account secrets and keys)?
I tried using
const logo = document.querySelector(".navbar-brand img");
logo.src = "/static/fun_share/img/logo/logo-2.svg";
but it doesn't work as expected, as the javascript call is made to the server itself rather than being redirected to the s3 bucket.
Any assistance would be greatly appreciated.