更新:我已经更新了以下内容--这是那个特定网页的html文件。
<!-- load the path to your static file-->
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'music/style.css'%}"/>
{% if all_albums %}
<h3>Here are all my albums:</h3>
<ul>
{% for album in all_albums %}
<li><a href="{% url 'music:detail' album.id %}">{{ album.album_title }}</a></li>
{% endfor %}
</ul>
{% else %}
<h3>You don't have any albums</h3>
{% endif %}下面是CSS文件:
body{
backgroud : white url("images/background.jpg");
}我还更改了设置文件如下:
import os
STATIC_URL = 'static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "music\static"),)您可以在下面看到我的项目树,以获得更多的澄清:

现在没有错误,但我试图获取的背景图像现在显示在该网页上:
请帮帮我!这是因为社区版吗?
发布于 2022-09-25 08:27:24
要从CSS文件加载静态内容,必须使用完整的静态URL,如下所示
body{
backgroud : white url("/static/images/background.jpg");
}https://stackoverflow.com/questions/73842885
复制相似问题