Django入门笔记【六】
2015-06-25 12:43
423 查看
入门笔记翻译整理自:https://docs.djangoproject.com/en/1.8/
*该笔记将使用一个关于投票网络应用(poll application)的例子来阐述Django的用法。
*静态文件(static files):images, JavaScript, CSS
在polls/static/polls/style.css中添加:
在文件polls/templates/polls/index.html顶部添加:
-- The End --
*该笔记将使用一个关于投票网络应用(poll application)的例子来阐述Django的用法。
*静态文件(static files):images, JavaScript, CSS
1. 自定义应用外观(look and feel)
创建polls/static目录。Django的STATICFILES_FINDERS会寻找静态文件。在static目录下,创建polls/style.css文件。在polls/static/polls/style.css中添加:
# polls/static/polls/style.css li a { color: green; }
在文件polls/templates/polls/index.html顶部添加:
#polls/templates/polls/index.html {% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />
2. 添加背景图片
在polls/static/polls下创建images目录,在其中放入background.gif。对style.css添加:body { background: white url("images/background.gif") no-repeat right bottom; }
-- The End --
相关文章推荐
- Django入门笔记【五】
- Golang import 导入包的语法
- django使用group by
- 时间区间的操作:mongoose的aggregate无法match,但是find却可以找到。(非ObjecetID)
- Algorithms—77.Combinations
- EGOTableViewPullRefresh实现下拉刷新
- django+uwsgi报错libgcc_s.so.1 must be installed for pthread_cancel to work
- mongose排序查询
- Date类与GregorianCalendar类对时间的操作
- poj 2762 Going from u to v or from v to u(targan缩点+拓扑排序)
- 基于Theano的DL的开源小框架:Dragon
- when going for the shoe
- Instagram is a gold
- 用django框架做自己的blog
- 【Go语言】【11】GO语言的包和函数
- 【Go语言】【11】GO语言的包和函数
- Django学习笔记(一)环境搭建基础教程示例
- 收集的一些关于Mongo的博客
- poj 1003 Hangover
- GO GO GO