Answer the question
In order to leave comments, you need to log in
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
File: settings.py
STATIC_URL = '/static/'
File tree:
Answer the question
In order to leave comments, you need to log in
Well, the absolute path should not be /images/2_venus.jpg, but /static/planets/images/2_venus.jpg
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 questionAsk a Question
731 491 924 answers to any question