title: Can't seem to load images in Django?
body: <p>This ought to be quite straight forward but I have a feeling one of the pathnames is screwing the whole thing up. Basically, my images are displaying as 404. </p>
  
  <p>Here are the relevant parts to my Django app:</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class MemeDetails(models.Model):
      datecreated = models.DateTimeField(default=datetime.datetime.now)
      profileimage = models.ImageField(upload_to="memeimages", blank=True)
      name = models.CharField(max_length=50)
      description = models.CharField(max_length=1000)
      origin = models.CharField(max_length=50)
      origindate = models.DateField()
  </code></pre>
  
  <p><strong>settings.py</strong></p>
  
  <pre><code>MEDIA_ROOT = '/home/nai/Projects/meme/media/'
  MEDIA_URL = '/media/'
  </code></pre>
  
  <p>So all the images go into this folder <code>home/nai/Projects/meme/media/memeimages</code></p>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>urlpatterns = patterns('',
      (r'^media/(?P&lt;path&gt;.*)$', 'django.views.static.serve',
                   {'document_root': settings.MEDIA_ROOT}),
  )
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def memepage(request, memeid):
  
      q = MemeDetails.objects.get(id=memeid)
      memeimage = q.profileimage
  
      return render_to_response('memepage.html', {'memeid': memeid, 'memeimage': memeimage},context_instance=RequestContext(request))
  </code></pre>
  
  <p><strong>template</strong></p>
  
  <pre><code>&lt;img src="{{ MEDIA_URL }}{{memeimage }}" /&gt;, {{ memeid }}
  </code></pre>
  
  <p>The actual URL of the image is at this URL <code>http://127.0.0.1:8000/media/memeimages/flickrphotobrowser.png</code> but I am getting a 404. </p>
  
  <p>P.S I know I should use Apache to serve my static images on my production environment. I'm just trying to get this to work.</p>
  
  <p>Help!</p>