1 更目录下建立static包,把css文件拉进去

2 settings文件里添加:

STATIC_ROOT = os.path.join(BASE_DIR, "static/")
# STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)

然后在界面页快捷键option+r,打开manage.py shell,执行命令:

collectstatic

3 settings文件里处理:

# STATIC_ROOT = os.path.join(BASE_DIR, "static/")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)

4 html中引用:

{% load static %}
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<link href="{% static 'home.css' %}" rel="stylesheet" type="text/css">