django 模板链接css

在项目的app目录下建个static文件夹,在这里放css文件

比如

appname/static/index.css

 html中这样写

{% load staticfiles %}

<link rel="stylesheet" type="text/css" href="{% static 'index.css' %}" />

另一个问题   网页有中文会报错

同样是中文,有些能显示,某些会报错,说UnicodeDecodeError at /

用notepad打开,把编码格式改成utf-8

猜你喜欢

转载自wzgdavid.iteye.com/blog/2091940