flask bootstrap

Step 1: Install Flask and Flask-Bootstrap

pip install Flask Flask-Bootstrap

Step 2: Create a Flask App

from flask import Flask, render_template
from flask_bootstrap import Bootstrap

app = Flask(__name__)

def index():
    return render_template('index.html')

if __name__ == '__main__':

Step 3: Create Templates Folder and HTML File - Create a folder named "templates" in the same directory as your main script. - Inside the "templates" folder, create an HTML file (e.g., index.html) with the following content:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flask Bootstrap Example</title>
    {% block styles %}
        {{ bootstrap.load_css() }}
    {% endblock %}
    <div class="container">
        <h1>Hello, Flask Bootstrap!</h1>
    {% block scripts %}
        {{ bootstrap.load_js() }}
    {% endblock %}

Step 4: Run the Flask App

python your_script_name.py

Visit in your web browser to see the Flask app with Bootstrap styling.