Registry / web-framework / flask-bootstrap

flask-bootstrap

JSON →
library3.3.7.1pypypi✓ verified 35d ago

Flask-Bootstrap is an extension that packages Twitter Bootstrap (version 3.3.7.1) into a Flask application, providing template macros and resources without requiring boilerplate code. It simplifies the integration of Bootstrap's CSS and JavaScript components into Flask projects. The project's last release was in January 2017, and it is primarily designed for Bootstrap 3 and has Python 2 classifiers.

web-framework
Install & Compatibility
Where this runs
tested against v3.3.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.645s · 25.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.1s · import 0.595s · 26MB
24MB installed
● package 24MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The class is simply `Bootstrap`.

from flask_bootstrap import Bootstrap

Initialize the Flask app and the Bootstrap extension, then create a simple route that renders a template extending `bootstrap/base.html` to inherit Bootstrap's styling and scripts. The `SECRET_KEY` is required by Flask for certain functionalities (e.g., flashed messages).

from flask import Flask, render_template from flask_bootstrap import Bootstrap import os app = Flask(__name__) app.config['SECRET_KEY'] = os.environ.get('FLASK_SECRET_KEY', 'a_secret_key_for_dev') bootstrap = Bootstrap(app) @app.route('/') def index(): return render_template('index.html') # To run this, save as app.py and create templates/index.html: # # templates/index.html # {% extends "bootstrap/base.html" %} # {% block title %}My Flask-Bootstrap App{% endblock %} # # {% block content %} # <div class="container"> # <h1>Hello, Flask-Bootstrap!</h1> # <p>This is a basic Flask application with Bootstrap 3 via Flask-Bootstrap.</p> # <button type="button" class="btn btn-primary">Primary button</button> # </div> # {% endblock %} if __name__ == '__main__': app.run(debug=True)
Debug
Known footguns
breakingFlask-Bootstrap is tied to Bootstrap 3.3.7.1, an older version of Bootstrap. For Bootstrap 4, 5, or later, use `Bootstrap-Flask` instead.
deprecatedThe project appears to be abandoned, with its last release in 2017 and PyPI classifiers indicating Python 2 support. There is no active development for newer Python or Bootstrap versions.
gotchaWhen overriding template blocks (e.g., `styles`, `scripts`) in `bootstrap/base.html`, you must include `{{ super() }}` to retain Bootstrap's default content. Otherwise, your custom content will entirely overwrite Bootstrap's.
gotchaThe correct way to initialize the extension is `bootstrap = Bootstrap(app)`. Simply calling `Bootstrap(app)` might work in some basic scenarios but the explicit assignment is recommended for consistency and proper behavior with certain Flask features.
gotchaFlask-Bootstrap bundles jQuery 1.x. If your application or other JavaScript libraries require jQuery 2.x or later, you'll need to manually include the desired jQuery version via a CDN or local static files.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources