I'm trying to put an image in the html code, using:
<img scr="{% static "degustos/empanadas.jpg" %}" class="card-img-top" alt="Empanadas Ilustrativas"/>
but the image isn't displayed. On the other hand, I can access the image going to http://localhost:8000/static/degustos/empanadas.jpg
My settings.py:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
It's deployed in Heroku. Thanks!
You'll kick yourself. You've got scr=
instead of src=
.