[Answer]-Serving static files in Django development

1👍

Ok I’ve found a solution:

STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ('C:/projects/foobar/static',)

This way I just refer to /static/ from within the templates. It’s weird that STATIC_ROOT needs to be emtpy and STATICFILES_DIRS is what counts though, it’s counter-intuitive.

This doesn’t require for the static folder to be inside an app, it can just be in the project’s root and it requires no change to urls.py nor the use of the collectstatic command

Leave a comment