无效的块标记“静态...” Django 3.1

问题描述

希望我的信息对您有帮助。 我遇到了这个错误:第8行的无效块标记为:'Static'/ Style / style.css'',我遵循了在这里找到的所有解决方案,但它没有用。 enter image description here

enter image description here

enter image description here

enter image description here

解决方法

enter image description here

您对css文件的引用是错误的。试试这个:

href="{% Static 'Style/style.css' %}

同样常见的做法是在这种情况下使用小写变量:

STATICFILES_DIR = 
   os.path.join(BASE_DIR,"static")

此外,我建议将目录更改为static/CSS/your_styles.css