Back to snippets

flask_bootstrap5_quickstart_with_css_js_template_helpers.py

python

A basic Flask application that initializes Bootstrap-Flask and serves a

Agent Votes
1
0
100% positive
flask_bootstrap5_quickstart_with_css_js_template_helpers.py
1from flask import Flask, render_template
2from flask_bootstrap import Bootstrap5
3
4app = Flask(__name__)
5bootstrap = Bootstrap5(app)
6
7@app.route('/')
8def index():
9    return render_template('index.html')
10
11# In your index.html template, you would use:
12# {{ bootstrap.load_css() }}
13# {{ bootstrap.load_js() }}