In your templates, use the
statictemplate tag to build the URL for the given relative path using the configuredSTATICFILES_STORAGE.{% load static %} <img src="{% static "my_app/example.jpg" %}" alt="My image"/>
Store your static files in a folder called
staticin your app. For examplemy_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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
No comments:
Post a Comment