Hi!

Because static is a folder on the root of your website, try putting
a slash in front of static; for example,

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

Hope this helps. :-)

Sincerely,
Carl

-------- Original Message --------
Subject: Images are not displaying
Local Time: June 16, 2017 1:44 AM
UTC Time: June 16, 2017 5:44 AM
From: [email protected]
To: Django users <[email protected]>

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].
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/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/169zHcqyX29FYNm7sLfBk3FbH72r5PDtmPM9uY0M_-cow9udRGutLTgzU9QZ0BgkCiJTkiI6l5oAGMCjH9N3pVpJl8bTvNyW6y5qvt5Wq8Y%3D%40nexuspro.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to