I'm trying to display an image located in my static directory. Here is my code :
My directories
My static settings
I'm trying to display an image located in my static directory. Here is my code :
My directories
My static settings
You have a typo in your settings.py
instead of STATICFILES_DIR
, add the S
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
Use below setting
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'staticfiles')
]
and move your image files to static
folder
Difference between STATIC_ROOT
, STATICFILES_DIRS
and STATIC_URL
can be found here