UPDATE: I have updated the followin This is the html file for that specific webpage.
JavaScript
x
16
16
1
<!-- load the path to your static file-->
2
{% load static %}
3
4
<link rel="stylesheet" type="text/css" href="{% static 'music/style.css'%}"/>
5
6
{% if all_albums %}
7
<h3>Here are all my albums:</h3>
8
<ul>
9
{% for album in all_albums %}
10
<li><a href="{% url 'music:detail' album.id %}">{{ album.album_title }}</a></li>
11
{% endfor %}
12
</ul>
13
{% else %}
14
<h3>You don't have any albums</h3>
15
{% endif %}
16
Here is the CSS file:
JavaScript
1
4
1
body{
2
backgroud : white url("images/background.jpg");
3
}
4
I have also changed the settings file like this:
JavaScript
1
5
1
import os
2
3
STATIC_URL = 'static/'
4
STATICFILES_DIRS = (os.path.join(BASE_DIR, "musicstatic"),)
5
You can see my project tree as under for more clarification:
Now there is no error but the background image that I am trying to get is now shown on that webpage:
Please help me out! Is this because of COMMUNITY EDITION?
Advertisement
Answer
to load the static content from the CSS file, you have to use full static URL like
JavaScript
1
4
1
body{
2
backgroud : white url("/static/images/background.jpg");
3
}
4