Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use Bootstrap theme in Django? [closed]

I am new to Python programming and just started Django, I have a small task to use build a bootstrap blog. I have done some work with jinja templates in django. But i want to know how would i use bootstrap 3 in django because django templates work on jinja style like blocks statements and inheritance.

lot of confusion, any one here who have done this sort of work, kindly help. also google it and found a lot of libraries, but the structure is confusing me, keep in mind that i am at beginner level.

like image 220
Muhammad Taqi Avatar asked Dec 23 '14 06:12

Muhammad Taqi


People also ask

How do I reuse a Django template?

The most flexible way to reuse template fragments is to define an inclusion_tag. You can pass arguments to your custom tag, process them a bit in Python, then bounce back to a template. Direct inclusion only works for fragments that don't depend on the surrounding context.

Is Bootstrap good for Django?

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.

What does {% %} mean in Django?

{% %} and {{ }} are part of Django templating language. They are used to pass the variables from views to template. {% %} is basically used when you have an expression and are called tags while {{ }} is used to simply access the variable.


1 Answers

You can download the static files and copy them in your project's static library, or you can use them via CDN, that is putting in your template's header links to the 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>
like image 70
Riccardo Avatar answered Oct 02 '22 06:10

Riccardo