【发布时间】:2015-10-14 07:38:42
【问题描述】:
我有以下 base.html
{% load static from staticfiles %}
<html>
<title>COOL| {% block title %} Sometitle {% endblock %}</title>
<body>
<!--- BEGIN INSERT CONTENT FOR OTHER PAGE HERE-->
{% block 'body' %}
{% endblock %}
我有 somefile.html 被上面的包裹。
{% extends 'base.html'%}
{% block title %} Contact {% endblock %}
{% block 'body' %}
<h1> <a href="{%static "files/somefile.csv" %}">CSV</a> </h1>
{% endblock %}
我得到的信息是这样的:
Invalid block tag: 'static', expected 'endblock'
我预计somefile.html 将从base.html 继承{% load static from staticfiles %}。但事实并非如此。正确的做法是什么?
【问题讨论】:
标签: python html django templates