Solution 1 :

Make sure you indent the <img> tag. It is part of the body, !DOCTYPE has no closing tag , and use {% load static %} Before !DOCTYPE for ease of use. Also, like @Gaurav said, make sure that your settings have a static url and a dir for the files.

Here is the HTML fixed:

{% load static %}
<!DOCTYPE html>
<html>  
<head>
    <title>TEST</title>
</head>
<body>
    <h1  >Blog Home!</h1>

    <img src ="{% static 'images/imgtest.jpg' %}" />
</body>
</html>

If you still have problems, refer to This Website (docs).

Solution 2 :

Add the following code into your settings.py at the bottom.

STATIC_URL = '/static/'

STATICFILES_DIRS = (os.path.join(BASE_DIR,'static'),)

Problem :

<!Doctype html>
<html>  
<head>
    <title>TEST</title>
</head>
<body>
    <h1  >Blog Home!</h1>
{% load static %}
<img src ="{% static 'images/imgtest.jpg' %}" />
</body>
</html>
</!Doctype html>

this is the code Tree and the code in HTML please

Comments

Comment posted by Willem Van Onsem

Can you share the relevant

Comment posted by Willem Van Onsem

A

Comment posted by IYAS Ray

thanks every one i solve it and i will learn from my mistakes

Comment posted by MeL

There is no reason to indent the

Comment posted by neuops

Agreed, @MeL. I said this because it is pretty much an HTML convention.

By

Leave a Reply

Your email address will not be published. Required fields are marked *