[英]Cannot access staticfiles using Pycharm Community Edition
我正在使用 Pycharm 社區版,我是新手,Django 也是如此。 我正在嘗試使用 CSS 文件為我的網頁獲取背景圖像。
這是該特定網頁的 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, "static/"),)
您可以在下面查看我的項目樹以獲得更多說明:
每當我刷新頁面時,都會出現兩個錯誤:
請幫幫我? 這是因為社區版嗎?
第三行缺少結束href
<link rel="stylesheet" type="text/css" href="{% static '/music/style.css' %}"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.