summaryrefslogtreecommitdiff
path: root/docs/ref/templates
diff options
context:
space:
mode:
authorJohannes Hoppe <info@johanneshoppe.com>2015-11-07 12:24:38 +0100
committerTim Graham <timograham@gmail.com>2015-12-10 14:30:19 -0500
commitcf546e11ac76c8dec527e39ff8ce8249a195ab42 (patch)
treec86d039e94099e47382bbeaf4361fef22bbcf55e /docs/ref/templates
parent6be9589eb34f79914666c9d9e1e15bdb7fc44df2 (diff)
Fixed #21221 -- Made form Media and static template tag use staticfiles if installed.
Diffstat (limited to 'docs/ref/templates')
-rw-r--r--docs/ref/templates/builtins.txt23
1 files changed, 11 insertions, 12 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 680f9eda9b..da6df4472f 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -2399,8 +2399,9 @@ static
""""""
To link to static files that are saved in :setting:`STATIC_ROOT` Django ships
-with a :ttag:`static` template tag. You can use this regardless if you're
-using :class:`~django.template.RequestContext` or not. For example::
+with a :ttag:`static` template tag. If the :mod:`django.contrib.staticfiles`
+app is installed, the tag will serve files using ``url()`` method of the
+storage specified by :setting:`STATICFILES_STORAGE`. For example::
{% load static %}
<img src="{% static "images/hi.jpg" %}" alt="Hi!" />
@@ -2418,18 +2419,16 @@ slightly different call::
{% static "images/hi.jpg" as myphoto %}
<img src="{{ myphoto }}"></img>
-.. note::
+.. admonition:: Using Jinja2 templates?
+
+ See :class:`~django.template.backends.jinja2.Jinja2` for information on
+ using the ``static`` tag with Jinja2.
- The :mod:`staticfiles<django.contrib.staticfiles>` contrib app also ships
- with a :ttag:`static template tag<staticfiles-static>` which uses
- ``staticfiles'`` :setting:`STATICFILES_STORAGE` to build the URL of the
- given path (rather than simply using :func:`urllib.parse.urljoin` with the
- :setting:`STATIC_URL` setting and the given path). Use that instead if you
- have an advanced use case such as :ref:`using a cloud service to serve
- static files<staticfiles-from-cdn>`::
+.. versionchanged:: 1.10
- {% load static from staticfiles %}
- <img src="{% static "images/hi.jpg" %}" alt="Hi!" />
+ In older versions, you had to use ``{% load static from staticfiles %}`` in
+ your template to serve files from the storage defined in
+ :setting:`STATICFILES_STORAGE`. This is no longer required.
.. templatetag:: get_static_prefix