갈루아의 반서재

{% block content %} 안에 {% static 을 넣는 경우 아래와 같은 에러가 발생하는 경우가 있다.

Invalid block tag: 'static', expected 'endblock'


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{% extends "base.html" %}
 
{% block content %}
 
<title></title>
<-link rel="stylesheet" href="{% static 'timer/css/bootstrap.min.css' %}">
<div class="container">
    <div class="row">
        <div id="graph" class="span12"></div>
    </div>
</div>    
 
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="{% static 'd3js/js/histogram.js' %}"></script>
        
<h5><em>histogram-hours</em></h5>  
{% endblock content %}
cs


import 구문에 준해서 생각하면 되는데,base 템플릿의 "import" 명령은 파생되는 템플릿에까지 영향을 미치지 않는다.

따라서  {% load static %} 문을 상단에 넣어야 한다.