Templates contain standard HTML code (or any other text based content) and
template directives, delimited by '{% %}'. They can also contain placeholders,
delimited by '{{ }}', which content is processed and replaced with the
resulting value. The resulting values are basically the ones you pass using the
"template context". You can add filters (after the '|' symbol) for
post-processing the value before injecting it in the template.
To answer your precise question, the {% load static %} directive is inserted at
the beginning of your HTML template to instruct the templating engine that the
static resolution mechanism functions are used.
All this should be clear if you study Django templates documentation and the
accompanying examples.
Eric
________________________________
From: [email protected] <[email protected]> on behalf
of Avitab Ayan Sarmah <[email protected]>
Sent: Wednesday, June 6, 2018 6:42:51 PM
To: Django users
Subject: Please give the steps to follow this:
1. In your templates, use the
static<https://docs.djangoproject.com/en/2.0/ref/templates/builtins/#std:templatetag-static>
template tag to build the URL for the given relative path using the configured
STATICFILES_STORAGE<https://docs.djangoproject.com/en/2.0/ref/settings/#std:setting-STATICFILES_STORAGE>.
{% load static %}
<img src="{% static "my_app/example.jpg" %}" alt="My image"/>
2. Store your static files in a folder called static in your app. For
example my_app/static/my_app/example.jpg.
How do i use the static template tag?Because in my templates there is only html
files.Where do i add the statement {% load static %}? comment please
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
[email protected]<mailto:[email protected]>.
To post to this group, send email to
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/81a53388-6929-4bac-a12e-af9d46724004%40googlegroups.com<https://groups.google.com/d/msgid/django-users/81a53388-6929-4bac-a12e-af9d46724004%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/DB7P193MB03313CDD36256B3F3146C0E18C650%40DB7P193MB0331.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.