Django安装django-bootstrap3库

本文介绍如何在Django项目中安装并配置Bootstrap3库,包括使用pip安装库,设置settings.py,以及在网页中加载Bootstrap3的JS和CSS文件。通过示例代码,读者可以快速掌握Django结合Bootstrap3的部署流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

命令行安装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>

转载于:https://www.cnblogs.com/apollo1616/articles/10293252.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值