{"id":5935,"library":"flask-bootstrap","title":"Flask-Bootstrap","description":"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.","status":"abandoned","version":"3.3.7.1","language":"en","source_language":"en","source_url":"http://github.com/mbr/flask-bootstrap","tags":["Flask","Bootstrap","web development","UI framework","templating","Python2"],"install":[{"cmd":"pip install flask-bootstrap","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"The class is simply `Bootstrap`.","wrong":"from flask_bootstrap import FlaskBootstrap","symbol":"Bootstrap","correct":"from flask_bootstrap import Bootstrap"}],"quickstart":{"code":"from flask import Flask, render_template\nfrom flask_bootstrap import Bootstrap\nimport os\n\napp = Flask(__name__)\napp.config['SECRET_KEY'] = os.environ.get('FLASK_SECRET_KEY', 'a_secret_key_for_dev')\nbootstrap = Bootstrap(app)\n\n@app.route('/')\ndef index():\n    return render_template('index.html')\n\n# To run this, save as app.py and create templates/index.html:\n# # templates/index.html\n# {% extends \"bootstrap/base.html\" %}\n# {% block title %}My Flask-Bootstrap App{% endblock %}\n#\n# {% block content %}\n#   <div class=\"container\">\n#     <h1>Hello, Flask-Bootstrap!</h1>\n#     <p>This is a basic Flask application with Bootstrap 3 via Flask-Bootstrap.</p>\n#     <button type=\"button\" class=\"btn btn-primary\">Primary button</button>\n#   </div>\n# {% endblock %}\n\nif __name__ == '__main__':\n    app.run(debug=True)","lang":"python","description":"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)."},"warnings":[{"fix":"For modern Bootstrap versions, migrate to `Bootstrap-Flask`. Note that `Flask-Bootstrap` and `Bootstrap-Flask` cannot be used in the same Python environment.","message":"Flask-Bootstrap is tied to Bootstrap 3.3.7.1, an older version of Bootstrap. For Bootstrap 4, 5, or later, use `Bootstrap-Flask` instead.","severity":"breaking","affected_versions":"<=3.3.7.1"},{"fix":"For new projects or modern Bootstrap/Python versions, consider `Bootstrap-Flask`.","message":"The 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.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Always use `{{ super() }}` within overridden blocks: `{% block styles %}{{ super() }} <link rel=\"stylesheet\" href=\"/my_styles.css\">{% endblock %}`","message":"When 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you assign the initialized extension to a variable: `bootstrap = Bootstrap(app)`.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Add a `script` tag for a newer jQuery version in your `{% block scripts %}` with `{{ super() }}`.","message":"Flask-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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}