Skip to content

hfilimonescu/flask-bs4

Repository files navigation

Flask-BS4

Bootstrap v5.0.0-beta1

Downloads Downloads Downloads

Discrepancies to the Bootstrap Documentation:

  • _wrap_boolean will have an additional div without classes if the form_type is basic or floating

Usage

Here is an example:

from flask_bs4 import Bootstrap

[...]

Bootstrap(app)

This makes some new templates available, containing blank pages that include all bootstrap resources, and have predefined blocks where you can put your content.

As of version 3, Flask-Bootstrap has a proper documentation, which you can check for more details.

Sample App

Welcome to the Flask-BS4 sample app. This will give you an overview of how the Flask-BS4 package can render different types of input fields.

First you should create a virtual environment. I prefer using:

$ python3 -m venv venv

To run this application yourself, please install its requirements first:

$ pip install -r sample_app/requirements.txt

Then, you can actually run the application. Optionally you can set FLASK_ENV=development.

$ export FLASK_APP=sample_app
$ flask run

Afterwards, point your browser to localhost:5000, then check out the source.

This is a fork of Flask-Bootsrap upgraded to Bootstrap 5.x.x.

Flask-Bootstrap packages Bootstrap into an extension that mostly consists of a blueprint named bootstrap. It can also create links to serve Bootstrap from a CDN and works with no boilerplate code in your application.