title: Django Get image from s3 bucket if image source is stored in a database
body: <p>I have a model where users upload pictures to an s3 bucket.</p>
  <pre><code>class Curso(models.Model):
      titulo = models.TextField()
      foto = models.ImageField(upload_to='media/cursos') #this goes to mybucket/media/cursos
      alt = models.TextField()
      ...
  </code></pre>
  <p>It uploads fine to the s3 bucket but the source to the images gets stored in the database like</p>
  <pre><code>&quot;media/cursos/theimage.jpg&quot;
  </code></pre>
  <p>And I would like to display the images from the objects in a template like this</p>
  <pre><code> &lt;img class='curso__tarjeta--imagen' loading=&quot;lazy&quot; src=&quot;{{curso.foto}}&quot; alt={{curso.alt}}&quot;&gt;
  
  </code></pre>
  <p>But <strong>it doesn't work because the path is not the whole path my s3 bucket</strong></p>
  <p>My static tag is pointing to my s3 bucket. My question is: is there a way to do something like this -&gt;</p>
  <pre><code>{% load static %}
  &lt;img class='curso__tarjeta--imagen' loading=&quot;lazy&quot; src=&quot;{%static%}{{curso.foto}}&quot; alt={{curso.alt}}&quot;&gt;
  </code></pre>
  <p>I'm trying like that but it doesn't work!
  What should I do?
  Help! And thank you in advance</p>