How to use Bootstrap theme in Django?

I am new to Python programming and have just started Django, I have a small task to use the build blog assembly. I did some work with jinja templates in django. But I want to know how to use bootstrap 3 in django, because django templates work in jinja style, such as block instructions and inheritance.

a lot of confusion, someone here who has done such a job will kindly help. also google he found a lot of libraries, but the structure confuses me, keep in mind that I am at the initial level.

+4
source share
3 answers

You can load static files and copy them into the static library of the project, or you can use them via CDN, which places your template header links in Bootstrap CDN:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
+7
source

I will repeat what the other answers talked about, but for a brief and simple example you can see:

http://www.tangowithdjango.com/book/chapters/bootstrap.html

for step-by-step instructions on downloading your django application.

+4
source

django, , css, js .

css css, js js .

:

{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/bootstrap.css">

staticfiles,

{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.css' %}">

js . django docs, -!

+3

Source: https://habr.com/ru/post/1568704/


All Articles