一、静态文件
创建static在app的目录下,polls/static/。和建立templates类似,还需要在建立app名字命名的文件夹。将文件放于其下polls/static/polls/。
1.1 添加css
建立css文件夹,再建立style.css,写入:123li a { color: green;}
修改index.html12{% load static %}<link rel="stylesheet" type="text/css" href="{% static 'polls/css/style.css' %}" />
1.2 添加图片
建立文件夹polls/static/polls/images,在其中放置background_001.jpg。添加。123body { background: white url("../images/background_001.jpg") no-repeat right bottom;}