On Sun, 2009-08-23 at 06:54 -0700, When ideas fail wrote: > Hello, i'm having a problem getting images to display so I was > wondering if someone would be kind enough to help? > > I have my settings.py set up as follows (content is the folder where > my static images are stored): > > MEDIA_ROOT = '/home/mysite/content/' > MEDIA_URL = 'http://www.mysites.net/content/' > > Then my template is like so: > > <img src="{{ MEDIA_URL }}{{ object.post_img }}" /> > > where object.post_img = imgs/newMessage.jpg > > but if i load the page up it doesn't appear. I checked the error log > it says: > > File does not exist: /home/mysite/public_html/content, referer: > http://www.mysite.net 1. Check what's getting rendered in your HTML file for the src of that img.
2. Make sure you're using a RequestContext, otherwise you won't have MEDIA_URL available to your templates. 3. Figure out why public_html is showing up in the path reported by the error log. Some information that will help with debugging: * Are you using apache, the dev server, or something else? * If the dev server, where does your URLConf point to for static images? * What does the URLConf and view look like for the page that's getting rendered? Cheers, Cliff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---