Home > database >  cannot import name 'Bootstrap5' from 'flask_bootstrap'?
cannot import name 'Bootstrap5' from 'flask_bootstrap'?

Time:01-12

I am running this code

from flask import Flask, flash, jsonify

from flask_bootstrap import Bootstrap5

and I get this error

cannot import name 'Bootstrap5' from 'flask_bootstrap'

I am running this on Mac, python3

CodePudding user response:

According to Bootstrap documentation, basic usage

from flask import Flask
from flask_bootstrap import Bootstrap

def create_app():
  app = Flask(__name__)
  Bootstrap(app)

  return app

# do something with app...

Import Bootstrap instead if Bootstrap5

CodePudding user response:

follow the instructions on https://bootstrap-flask.readthedocs.io/en/stable/basic/#installation

pip uninstall flask-bootstrap bootstrap-flask
pip install bootstrap-flask
  • Related