【发布时间】:2012-12-10 09:48:51
【问题描述】:
我在模板中引用静态文件时遇到了困难。我正在使用 Twitter Bootstrap 并将引导文件(css、img、js)放在 mysite/static 中。
我已经根据this tutorial设置了STATIC_URL、STATIC_ROOT和TEMPLATE_CONTEXT_PROCESSORS。我已经运行了./manage.py collectstatic,它复制了 72 个文件。我还在我的模板 (index.html) 文件中添加了以下模板标签,但这没有用。
{% load staticfiles %}
<link rel="stylesheet" href="{% static user_stylesheet %}" type="text/css" media="screen"/>
任何有关如何引用文件以便引导样式返回到模板的帮助将不胜感激!
【问题讨论】:
标签: python django templates twitter-bootstrap static