Skip to content
Advertisement

Tag: digital-ocean

How to include Django static URL using JavaScript?

I have a django application storing static images on digital ocean spaces. I can easily display these static images in my template by doing:<img>{% static ‘images/my_image.png’ %}</img> If I inspect the HTML page after this loads, I will see something like: https://nyc3.digitaloceanspaces.com/nameofmyspace/nameofmyspace-space-static_DEV/images/my_image.png?AWSAccessKeyId=XXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXX%3D&Expires=1621600823 But now I want to have this image change dynamically using javascript. So I tried: document.getElementById(id+”dynamicImage”).src = “{%

Advertisement