命令行安裝django-bootstrap3庫
pip install django-bootstrap3
配置文件settings.py設置
INSTALLED_APPS = [
...
# 第三方應用程序
'bootstrap3'
]
### 安裝jquery文件
BOOTSTRAP3 = {
'include_jquery':True,
}
網頁中加載bootstrap3的js,css文件
{% load bootstrap3 %}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Bootstrap Learning</title>
{% bootstrap_css %}
{% bootstrap_javascript %}
</head>
<body>
<div class="page-header">
<h1>
Example page header
<small>Subtext for header</small>
</h1>
</div>
</body>
</html>