Re: displaying images
Hi,
did you read and do the tutorials? If not do it and you will learn a lot. [1]
In the tutorial you would learn that you would not want to write HTML code inside a view (function) but in a HTML template.
You should also read about how to server static media.[2]
[1] https://docs.djangoproject.com/en/1.3/intro/tutorial01/
[2] https://docs.djangoproject.com/en/1.3/howto/static-files/
Good luck
On Nov 23, 2011, at 17:31 , marjenni wrote:
> Hi all,
> Again, I am sure this is a very common problem for beginners, but
> all help appreciated.
>
>
> In a python function I am building a webpage, and trying to add
> images to a table like this:
>
> html += "<tr> <td><img src=\"/home/www/mysite/images/%s.jpg\" /></td>
> </tr>" % imageName
>
> return HttpResponse(html)
>
>
> Now the table is displayed fine, but images are missing.
>
> The images are present in the directory /home/www/mysite/images/
>
> and in settings.py
>
> MEDIA_URL = '/home/www/mysite/cache/'
>
> any suggestions?
>
> many thanks
>
> Mark
>
>
>
>
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home