STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
BASE_DIR / 'static'
]
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
STATICFILES_DIRS = [
BASE_DIR / "static",
'/var/www/static/',
]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
BASE_DIR / 'static'
]
# add this code in settings.py
STATICFILES_DIRS = [
BASE_DIR / "static",
'/var/www/static/',
]
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
#In your templates, use the static template tag to build the URL for the given relative path using the configured STATICFILES_STORAGE.
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
<!-- In your templates, use the static template tag to build
the URL for the given relative path using the configured
STATICFILES_STORAGE. -->
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
# 1. Make sure that django.contrib.staticfiles is included in your
# INSTALLED_APPS.
# 2. In your settings file, define STATIC_URL, for example:
STATIC_URL = '/static/'