Hello,

> *<img src="static/images/logo.jpg" alt="My Logo"/>*
This is probably missing a slash before "static"; it should be like this:

<img src="/static/images/logo.jpg" alt="My Logo"/>

But a better way is this:

{% load static %}

...

<img src="{% static 'images/logo.jpg' %}" alt="My Logo"/>

If you are on production rather than development, see also this:
https://djangodeployment.com/2016/11/21/how-django-static-files-work-in-production/

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 2017-06-16 08:44, Santosh Yelamarthi wrote:
> Hi,
>
> am using django 1.10 version. am unable to display images in web.
>
> my app name -- polls
>
> I created templates directory and i put my *home.html* over there 
> *<html>*
> *<body>*
> *<img src="static/images/logo.jpg" alt="My Logo"/>*
> *</div>*
> *</body>*
> *</html>*
>
> I created static folder and i put my image *logo.jpg* over there
>
> In my views file I imported home.html :
>
> *from django.shortcuts import render_to_response*
> *from django.http import HttpResponse*
> *
> *
> *# Create your views here.*
> *def index(request):*
> *    return render_to_response('home.html')*
>
> settings.py :
>
> *STATIC_URL = '/static/'*
>
> I am able to display text but not images.
>
>
> Can any one please help me in this.
>
> Thanks in advance
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e3703e83-01d4-4412-9227-c82147262571%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e3703e83-01d4-4412-9227-c82147262571%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e8335af-c1fc-6883-dc28-96ec6181690c%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to