I have two directories.
static contains javascript and css files. In settings I wrote STATIC_URL = '/static/'
so they are included correctly.
But also I have folder images which has pretty many images. My question how can I make folder images also static, because I can't copy into into static.
Thank you.
I wanted to add a static directory called uploads. I tried settings.py first, but it didn't work. However, I managed to turn uploads into a secondary static URL by adding this line to the file urls.py:
url(r'^uploads/(?P<path>.*)$', static.serve, {'document_root': settings.BASE_DIR + "/uploads"}),
If you get into trouble importing static.serve, this is the line you need to import it:
from django.views import static
it looks like STATICFILES_DIRS
can take multiple paths:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
'/var/www/static/',
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With