How can I use Bootstrap 4 while using Flask for Python 3?
Asked Answered
S

1

18

I have checked and found that Flask-Bootstrap natively uses Bootstrap 3.3.7 when you install it by default. But actually I wanted to use Bootstrap 4+ for my project by using Flask-Bootstrap package, any help would be much appreciated of how to update it or anything like that. Thanks

Structure answered 18/1, 2019 at 16:16 Comment(0)
C
28

There is a fork called Bootstrap-Flask that is up to date.

That said, however, it is not a good idea to use either Flask-Bootstrap or Bootstrap-Flask. These are very thin packages with a small layer of indirection that primarily serve to obscure your understanding.

Instead, I recommend using the starter template provided by Bootstrap 4, which will always be up to date to whatever version you require using their CDN.

If you stick with Bootstrap, you will soon want to build your own Bootstrap anyways so you can do things like add custom themes. Hacking Bootstrap with CSS instead of using their SASS customization scheme is painful (I did it for a while). The build process is well documented and simple enough, just a few installations required.

Coordination answered 18/1, 2019 at 16:22 Comment(7)
I get your point, but actually I wanted something that allows me to integrate onto my project fast, so I had used Flask-Bootstrap. For example it had different orientation for things like WTForms for Flask.Structure
@Structure So then use Bootstrap-Flask which is up to date. It is exactly what you asked for.Coordination
I too want to use the latest bootstrap for flask 1.1. Why hasn't the package been updated anyway ?Letterperfect
Just a heads up! Boostrap-Flask is being actively developed as of now. It now supports Bootstrap 4 & Flask 1.x.Sophistry
@Sophistry Until it's out of date again. Have you ever actually looked at the code for Boostrap-Flask or Flask-Boostrap? These 'projects' are pointless. Just use the template that is maintained by the Boostrap team that will always be up to date.Coordination
@Coordination true! Besides, lesser dependencies, the lesser risk of sliding into dependency hell.Sophistry
I agree but what I am looking for is how to use bootstrap I built in a flask project. Just stick it under static and reference it as a local script I guess???Eugenieeugenio

© 2022 - 2024 — McMap. All rights reserved.