title: Django Static image File Failed to load resource
body: <p><strong>FIXED</strong>
  This was my solution, in the main programs urls.py I had to add these lines.</p>
  
  <p>from django.conf import settings
  from django.conf.urls.static import static</p>
  
  <p>urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)</p>
  
  <p>I have an model called Item within there I have an image field. I added an new item with an image to the database and tried loading it inside of my index template. However I dont get an image when I look at the console it says ("WEBSITENAME/site_media/items/image.jpg 404 (Not Found)")</p>
  
  <p>I think the problem lies within the settings.py file but I cant figure out what exactly I did wrong here.</p>
  
  <p><strong>index.html template</strong></p>
  
  <pre><code>{% load static %}
  &lt;div class="item" style="background-image: url('{{ item.img.url }}')"&gt;`
  </code></pre>
  
  <p><strong>Model.py</strong></p>
  
  <pre><code>class Item(models.Model):
      name = models.CharField(max_length=200)
      img = models.ImageField(upload_to='items', default='', blank=True, null=True)
  
      def __str__(self):
          return "%s" % (self.name)
  </code></pre>
  
  <p><strong>Views.py</strong></p>
  
  <pre><code>def index(request):
      latestItems = Item.objects.all().order_by('-id')[:3][::-1]
      return render(request, 'webshop/index.html', {'latestItems' :latestItems})
  </code></pre>
  
  <p><strong>settings.py</strong></p>
  
  <pre><code>SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
  MEDIA_ROOT = os.path.join(SITE_ROOT, 'site_media/')
  MEDIA_URL = 'site_media/'
  </code></pre>