[Answer]-Confusion with STATIC_ROOT in DjangoProject documentation

1👍

✅

It means where collectstatic will collect static files to. Collectstatic will take all static files from different static folders (in different apps, main static directory etc.) and put them in the location specified by STATIC_ROOT. The fact that it collects the files from various folders and into a single folder, and that STATIC_ROOT is a single folder is a slight pointer 😛

This is also in the documentation:

Warning:
This should be an (initially empty) destination directory for collecting your static files from their permanent locations into one directory for ease of deployment; it is not a place to store your static files permanently. You should do that in directories that will be found by staticfiles’s finders, which by default, are ‘static/’ app sub-directories and any directories you include in STATICFILES_DIRS).

So you should not initially store your static files in the folder specified by STATIC_ROOT. If a file is found in another location first, the initial file in your STATIC_ROOT directory will be overwritten and lost when collectstatic is run.

Leave a comment