Skip to main content

Bootstrap-Flask

Bootstrap 4 helper for Flask/Jinja2. Based on Flask-Bootstrap, but lighter and better.

Installation

$ pip install bootstrap-flask

Initialization

from flask_bootstrap import Bootstrap
from flask import Flask

app = Flask(__name__)

bootstrap = Bootstrap(app)

Resources helpers

When development, Bootstrap-Flask provides two helper functions that can be used to generate resources load code in template: bootstrap.load_css() and bootstrap.load_js()

Call it at your template, for example:

<head>
{{ bootstrap.load_css() }}
</head>
<body>
...
{{ bootstrap.load_js() }}
</body>

Macros

Macro Templates Path Description
render_field() bootstrap/form.html Redner a WTForms form field
render_form() bootstrap/form.html Render a WTForms form
render_pager() bootstrap/pagination.html Render a basic pagination, only include previous and next button.
render_pagination() bootstrap/pagination.html Render a standard pagination
render_nav_item() bootstrap/nav.html Render a navigation item
render_breadcrumb_item() bootstrap/nav.html Render a breadcrumb item
render_static() bootstrap/utils.html Render a resource reference code (i.e. <link>, <script>)

How to use these macors? It's quite simple, just import them from the correspond path and then call them like any other macro:

{% from 'bootstrap/form.html' import render_form %}

{{ render_form(form) }}

API documentation will coming soon...

Run the demo application

$ git clone https://github.com/greyli/bootstrap-flask.git
$ pip install flask flask-wtf flask-sqlalchemy bootstrap-flask
$ cd bootstrap-flask/examples
$ flask run

Now go to http://localhost:5000.

Changelog

1.0.3

Release date: 2018/7/16

  • Built-in resources will be used when FLASK_ENV set to development.
  • Change CDN provider to jsDelivr.

1.0.2

Release date: 2018/7/21

  • Include popper.js before bootstrap.js in bootstrap.load_js(). (#2)

1.0.1

Release date: 2018/7/1

  • Fix local resources path error
  • Add basic unit tests

1.0

Release date: 2018/6/11

Initialize release.

License

This project is licensed under the MIT License (see the LICENSE file for details).

Release files for Bootstrap-Flask 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Bootstrap-Flask 1.0.3
File Size Uploaded
Bootstrap-Flask-1.0.3.tar.gz 750.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Bootstrap-Flask 1.0.3
File Interpreter ABI Platform
Bootstrap_Flask-1.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size:1.5 MB

Release files / Bootstrap-Flask-1.0.3.tar.gz

Download URL Bootstrap-Flask-1.0.3.tar.gz
Size 750.9 kB
Tags Source
SHA-256 checksum
How to use checksums
84a07f8d64e531ae4ec40beb3e1426547225e28fbe30ea4ef3f40a64eafadfde
BLAKE2b-256 checksum
How to use checksums
2d1cb16c5ef7b6a75cadfff880a8d80ef91052f4f72c64fba948e782bde03d2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Bootstrap_Flask-1.0.3-py2.py3-none-any.whl

Download URL Bootstrap_Flask-1.0.3-py2.py3-none-any.whl
Size 767.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
873866bf766cc9923e331534e1d09225f0a915ff19fff5cd932c09521ffd659d
BLAKE2b-256 checksum
How to use checksums
b015aaee11e6e829c2aa9a0eaf0182e149ca86c40c45ad3c6c38b4dd64dd5ab8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.6.0

2 release files

2.5.0

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5

2 release files

1.4

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

1 release file

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page