mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #15252 -- Added static template tag and CachedStaticFilesStorage to staticfiles contrib app.
Many thanks to Florian Apolloner and Jacob Kaplan-Moss for reviewing and eagle eyeing. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e9a909e30a
commit
1d32bdd3c9
33 changed files with 646 additions and 148 deletions
|
@ -2353,9 +2353,9 @@ static
|
|||
|
||||
.. highlight:: html+django
|
||||
|
||||
To link to static files Django ships with a :ttag:`static` template tag. You
|
||||
can use this regardless if you're using :class:`~django.template.RequestContext`
|
||||
or not.
|
||||
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.
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
|
@ -2370,6 +2370,17 @@ It is also able to consume standard context variables, e.g. assuming a
|
|||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static user_stylesheet %}" type="text/css" media="screen" />
|
||||
|
||||
.. note::
|
||||
|
||||
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. Use that instead if you have an advanced use case such as
|
||||
:ref:`using a cloud service to serve static files<staticfiles-from-cdn>`::
|
||||
|
||||
{% load static from staticfiles %}
|
||||
<img src="{% static "images/hi.jpg" %}" />
|
||||
|
||||
.. templatetag:: get_static_prefix
|
||||
|
||||
get_static_prefix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue