I want to start using Twitter's Bootstrap for a recently started Django app. I have quite a bit of experience with Django, but I'm totally new to Bootstrap.
What's the best way to proceed? Are there any particular Boostrap apps for Django you would recommend or have experience with?
I understand that I could use Bootstrap directly, without any special Bootstrap-specific Django apps. However, I also read that the form rendering doesn't come out particularly well without a little server side support (rendering the Bootstrap specific CSS into the form HTML, for example).
There seem to be several projects, such as crispy forms, django-bootstrap-toolkit, etc. Looking at their project pages, I can see different levels of activity and support. If I decide to go with one of those, I would of course like to pick one which has some momentum and therefore a good likelihood of staying supported and maintained for a while. This is very important and so even if the particular app doesn't have all possible features or is a bit less flexible, it might still be a good choice, due to support/freshness, availability of examples, etc.
Thank you for any recommendations or feedback.
Bootstrap in Django. It is very easy to use Bootstrap in Django. Since Bootstrap is a front-end framework, it completely consists of CSS & JavaScript files. These files are considered static on the server-side.
"Responsiveness", "UI components" and "Consistent" are the key factors why developers consider Bootstrap; whereas "Rapid development", "Open source" and "Great community" are the primary reasons why Django is favored.
I used django-bootstrap-toolkit
— as the author explains (with reference to other Django/Bootstrap integration apps)
"The approach to template tags and filters seemed right, but Bootstrap does so much more than just forms."
In addition to forms, then (which can be as simple as {% form|as_bootstrap %}
, this app helps with pagination, inserting static URLs to the Bootstrap media files, and some other bits. Read templatetags/bootstrap-toolkit.py
for the full list.
@dolan notes that the django-bootstrap-toolkit
developer recommends a new project for Bootstrap v3 support, django-bootstrap3
. I haven't tried this yet as I haven't started a new project since V3 came out, so YMMV.
I've been using django-crispy-forms with bootstrap for the last couple of months and it has been quite useful. Forms render exactly as they're meant to. If you do any custom form rendering though, be prepared to define your forms in code rather than in template, using helpers
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With