title: Linking an image in Django
body: <p>I have a new django project called mysite. Inside mysite is a folder called static, where all my images are.</p>
  
  <p>Inside mysite is also a templates folder with a file named index.html with the the following basic code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;&lt;img src = WHAT GOES HERE?? /&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have this views.py file in my mysite folder: </p>
  
  <pre><code>from django.shortcuts import render_to_response
  def index(request):
      return render_to_response('index.html',)
  </code></pre>
  
  <p>In my settings.py file, STATIC_URL = '/static/'</p>
  
  <p>What is the exact text that should go inside my img tag to correctly reference the static image file (note: I am not looking for links to documentation). And do I need to change any of the folder/settings structure? Thank you.</p>
  
  <p>I have added the following tag:<br>
          &lt; img src="{{STATIC_URL}}logo.jpg"/></p>
  
  <p>However, it still does not load -- it seems to be going to the correct path though (image path in the browser says 127.0.0.1:8000/static/logo.jpg.). What do I need to change so this loads correctly? And I have checked to make sure the image is at that location.</p>
  
  <p>UPDATE: this is how I finally got it to work:</p>
  
  <pre><code>if settings.DEBUG:
      urlpatterns += patterns('',
          (r'^site_media/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root':     sttings.MEDIA_ROOT}),
  )
  </code></pre>
  
  <p>(I'm using the media_url instead of the static_url). Is there an easier way to do this?</p>