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].
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/81a53388-6929-4bac-a12e-af9d46724004%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.