I
I
Igor Andreev2018-05-07 23:14:29
css
Igor Andreev, 2018-05-07 23:14:29

Why is the background image not showing in the browser?

Hi everybody! I'm new, don't judge too harshly.
I'm learning django
Who can tell me why the image is not displayed in the browser?
The image is in the folder, the path is specified, but the terminal indicates that "Not Found: /images/2_venus.jpg" and the browser does not display
File: style.css
body {
background: white url("/images/2_venus.jpg") no -repeat;
background-size: 100%
}
File: main_planets.html
5af0b397edcfc719031374.png
File: settings.py
STATIC_URL = '/static/'
File tree:
5af0b290cd41a368736008.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2018-05-07
@Igorva

Well, the absolute path should not be /images/2_venus.jpg, but /static/planets/images/2_venus.jpg

R
Rostislav Grigoriev, 2018-05-07
@crazyzubr

Specify a relative path from the style file

background: white url("images/2_venus.jpg") no-repeat;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question