Fixed #21221 -- Made form Media and static template tag use staticfiles if installed.

This commit is contained in:
Johannes Hoppe 2015-11-07 12:24:38 +01:00 committed by Tim Graham
parent 6be9589eb3
commit cf546e11ac
34 changed files with 145 additions and 144 deletions

View file

@ -19,17 +19,17 @@ Configuring static files
STATIC_URL = '/static/'
3. In your templates, either hardcode the url like
``/static/my_app/myexample.jpg`` or, preferably, use the
:ttag:`static<staticfiles-static>` template tag to build the URL for the given
relative path by using the configured :setting:`STATICFILES_STORAGE` storage
(this makes it much easier when you want to switch to a content delivery
network (CDN) for serving static files).
``/static/my_app/myexample.jpg`` or, preferably, use the :ttag:`static`
template tag to build the URL for the given relative path by using the
configured :setting:`STATICFILES_STORAGE` storage (this makes it much easier
when you want to switch to a content delivery network (CDN) for serving
static files).
.. _staticfiles-in-templates:
.. code-block:: html+django
{% load staticfiles %}
{% load static %}
<img src="{% static "my_app/myexample.jpg" %}" alt="My image"/>
4. Store your static files in a folder called ``static`` in your app. For