I have following settings for static files
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static_my_proj'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn', 'static_root')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static_cdn', 'media_root')
In the css file I do this
#mydiv{
background-image: url('/img/myimg.png');
}
And my directory structure
project root
- static_my_proj
- css
- img
- js
I can see from network tab that it looks for the image in static/css/img/myimg.png. However, if I do this then it works. How can I make it without using ../ at the beginning?
#mydiv{
background-image: url('../img/myimg.png');
}
/static/img/myimg.png?/static/img/myimg.pngseems to be working.