Ensure that django.contrib.staticfiles
is added to your INSTALLED_APPS
In your settings file. define STATIC_URL for ex.
STATIC_URL = '/static/'
In your Django templates, use the static template tag to create the URL for the given relative path using the configured STATICFILES_STORAGE
.
{% load static %}
<img src="{% static 'my_sample/xyz.jpg' %}" alt="XYZ image"/>
Store your static files in a folder called static in your app. For example my_sample/static/my_sample/xyz.jpg