Hello,
Using the builtin/development web server, I am trying to embed an <img
src   > tag in an html response within HttpResponse, but am having no
luck with the link to the image.  Specifically:

Here's my return statement:
return HttpResponse('''<html><body><img src='http://localhost:8000/
mygraphic.png'></body></html>''')

Here are the relevant strings in settings.py:
MEDIA_ROOT = '/yadda1/yadda2/yadda3/yadda4/images/'
MEDIA_URL = 'http://localhost:8000/'

(The image file mygraphic.png is in the path indicated by MEDIA_ROOT).


When I try this at the browser (for which there is  URL regex to map
it to the right view):
http://localhost:8000/

I get the broken image icon in the browser with this source:
<html><body><img src='http://localhost:8000/mygraphic.png'></body></
html>

and I get this at the command line where I launched the server:
[06/Aug/2009 13:57:29] "GET / HTTP/1.1" 200 79
[06/Aug/2009 13:57:29] "GET /billingbarchart.png HTTP/1.1" 404 1999


Other observations:
I know that I'm getting to the view function, because I am able to
successfully get the image when I replace the above return statement
with:

 image_data = open( "/mylocalpath/mygraphic.png","rb" ).read()
 return HttpResponse(image_data,mimetype="image/png")


Any help or suggestions are appreciated.
Chuck



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to