title: Retrieve image in django
body: <p>I'm trying to make a gallery website but I cannot seem to retrieve the images to display in the html. I'm trying to retrieve images from the database based on a <code>filter_type</code> which has value as image.</p>
  
  <p>So far I have this:</p>
  
  <p>In <code>views.py</code></p>
  
  <pre><code>def gallery(request):
      img = Upload.objects.filter(file_type='image')
      return render(request,'gallery.html',{"img":img})
  </code></pre>
  
  <p>and in <code>html</code>:</p>
  
  <pre><code>{% for n in img %}
          &lt;img src="{{ n.img}}" /&gt;
  {% endfor %}
  </code></pre>
  
  <p>My <code>models.py</code> is as follow:</p>
  
  <pre><code>class Upload(models.Model):
      image = models.ImageField(upload_to='media/image',default='')
      text_field = models.CharField(max_length=200,default='')
      date_added = models.DateTimeField(auto_now_add=False,auto_now=True)
      file_type = models.CharField(max_length=256, choices=[('image', 'image'), ('video', 'video'), ('other', 'other')])
      class Meta:
          verbose_name_plural = "Files Manager"
  </code></pre>
  
  <p>I've also set up <code>MEDIA_URL</code> and <code>MEDIA_ROOT</code>. From the Admin I can upload images and they are ok.</p>
  
  <p>my <code>MEDIA_URL</code>:</p>
  
  <pre><code>MEDIA_ROOT = os.path.join(BASE_DIR,'static','media')
  
  MEDIA_URL = '/media/'
  </code></pre>
  
  <p>When I view the html the <code>src</code> path is empty.</p>