Tutorial_6:Static files

一、静态文件

创建static在app的目录下,polls/static/。和建立templates类似,还需要在建立app名字命名的文件夹。将文件放于其下polls/static/polls/

1.1 添加css

建立css文件夹,再建立style.css,写入:

li a {
    color: green;
}

修改index.html

{% load static %}

1.2 添加图片

建立文件夹polls/static/polls/images,在其中放置background_001.jpg。添加。

body {
    background: white url("../images/background_001.jpg") no-repeat right bottom;
}

你可能感兴趣的:(Tutorial_6:Static files)