Answer the question
In order to leave comments, you need to log in
How to use bootstrap when working with Django?
How to use bootstrap when working with Django? There is html :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Тестовый блог</title>
<link href="{{STATIC_URL}}bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
<style>
body {
padding-top: 60px;
}
</style>
<link href="{{STATIC_URL}}bootstrap/css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
<script src="{{STATIC_URL}}bootstrap/js/bootstrap.js" type="text/javascript"></script>
{% block extrahead %}
{% endblock %}
<script type="text/javascript">
$(function(){
{% block jquery %}
{% endblock %}
});
</script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<div class="brand">Тестовый блог</div>
<ul class="nav">
<li><a href="{% url 'list' %}" class="">Список постов</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
{% block content %}Empty page{% endblock %}
</div> <!-- container -->
</body>
</html>
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
Answer the question
In order to leave comments, you need to log in
The template with the output like this
will be empty.
This is the "old" style. In order to use it, you need to make a middleware that will add STATIC_URL to the context .
You need to do this
0. <!DOCTYPE HTML>
1. <meta charset="utf-8">
2.
<link href="{% static "bootstrap/css/bootstrap-responsive.css" %}" rel="stylesheet">
<script src="{% static "bootstrap/js/bootstrap.js" %}"></script>
{% load staticfiles %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question