我不确定如何将CSS包含到我的html中。我的项目中有一个应用程序,它有自己的模板文件夹。我想把sample.css
放到我的html中。在Django中导入应用程序css
在东西线<link rel="stylesheet" type="text/css" href="{% %}">
不是真的一定要放什么东西在{% %}
结构之间:
/proj
/app
/templates
sample.css
sample.html
这里是我的TEMPLATE_DIRS:
TEMPLATE_DIRS = (
os.path.join(BASE_DIR,'templates'),
os.path.join(BASE_DIR,'home/templates'),
os.path.join(BASE_DIR,'gallery/templates'),
os.path.join(BASE_DIR,'contact/templates'),
os.path.join(BASE_DIR,'aboutme/templates'),
)
如果任何其他信息是必需的。请告诉我!
更新struture
/proj
/app
/static
/css
sample.css
/templates
sample.html
@Liondancer你也应该把'css'文件放在其他文件夹中。它是将它们放在名为'app/static/css'的文件夹中的一种常见模式。 –
@RaydelMiranda,谢谢你的提示。 – alecxe
@RaydelMiranda如此重命名我的模板为静态? – Liondancer