pythondjangomakefile

Django collectstatic --no input Yes instead of no


I am using Django3 and i have currently the following command in my makefile for "Build"

python3 manage.py collectstatic 

to automate my buildprocess with a pipeline i would like to get rid of the prompt that asks

You have requested to collect static files at the destination location as specified in your settings:

URL

This will overwrite existing files! Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel

i found that out that i can add "--no-input" for the collectstatic at the end, but this will answer "no" in this case. Is there a way how i could say the script to answer "Yes" by default instead?


Solution

  • As mentioned in Django docs:

    On subsequent collectstatic runs (if STATIC_ROOT isn’t empty), files are copied only if they have a modified timestamp greater than the timestamp of the file in STATIC_ROOT.

    So django by default overwrites your modified files on collectstatic command, --noinput flag means it will not ask for your permission.