Django collectstatic "you're using the staticfiles app without having set STATIC_ROOT" in CI
collectstatic copies static assets into STATIC_ROOT, but the active settings did not define it. Django refuses to run the command without a target directory and raises ImproperlyConfigured.
What this error means
A python manage.py collectstatic --noinput build step fails with "ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path."
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app
without having set the STATIC_ROOT setting to a filesystem path.Common causes
STATIC_ROOT is undefined in the CI settings
A test or CI settings module omits STATIC_ROOT, so collectstatic has nowhere to write.
Wrong settings module for the build step
DJANGO_SETTINGS_MODULE points at a module that does not configure staticfiles for production-style collection.
How to fix it
Set STATIC_ROOT to a build path
Define an absolute path for collected files in the settings the build uses.
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
STATIC_ROOT = BASE_DIR / "staticfiles"Point the step at the right settings
Run collectstatic with the settings module that configures staticfiles.
python manage.py collectstatic --noinput \
--settings=myproject.settings.productionHow to prevent it
- Define STATIC_ROOT in any settings module used to build assets.
- Pick the correct DJANGO_SETTINGS_MODULE for each CI stage.
- Run collectstatic with --noinput so it never blocks on a prompt.