- 1. django-bootstrap3
- 2. Installing
- 3. Implementing
- 4. Using
Web site design and layout are pretty important issues, and sometimes it would be desirable to develop a website with good and interesting design ... but ... not all of us are designers, and even less good designers. So it was easier for me to take Bootstrap 3, to find a good skin for him, or rather in the same style customized CSS, and not bothered to start development of the site with the already proven by many web-masters of the instrument.
Let's see how to do it with Bootstrap 3 in Django .
django-bootstrap3
So, there is a ready Django application django-bootstrap3 , you want to install, connect, and use add the necessary components in the head tag on your pages.
Installing
Installing the application is executed by using pip utility, be sure to only activate the virtual environment.
pip install django-bootstrap3
Implementing
Before using Bootstrap, it must be connected in the configuration file.
INSTALLED_APPS = [ ... 'bootstrap3', ... ]
Using
Bootstrap module for Django can be used as a ready-made forms, without spending time on page-proofs and easy to use styles and jQuery library, which is used for this current version of Bootstrap.
For example, for minimum connection it is enough to connect styles files and script of Bootstrap in the head tag.
{% load bootstrap3 %} <script src="{% bootstrap_jquery_url %}"></script> {% bootstrap_javascript %} {% bootstrap_css %}
If you want to use fast customization form in bootstrap style, it will also need to specify the connection module in the template and use the template form for the module.
{% load bootstrap3 %} {# Display a form #} <form action="/url/to/submit/" method="post" class="form"> {% csrf_token %} {% bootstrap_form form %} {% buttons %} <button type="submit" class="btn btn-primary"> {% bootstrap_icon "star" %} Submit </button> {% endbuttons %} </form>
For Django I recommend VDS-server of Timeweb hoster .
Как вариант 1
вариант 2
И кстати заметил что прописывать скрипты бутстрапа {% bootstrap_javascript jquery='slim' %} надо все таки в footer. Так как могут не отработать объекты в других скриптах именно из-за очередности загрузки