How to write a script that does collectstatic for django

I want to do an automatic collectstatic script for my django application. I tried various things but it did not work. My last attempt is to call an expect script within a normal script:

collectstatic.sh:

python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh

testscript.sh:

#!/usr/bin/expect -f
spawn testscript.sh
expect "Type 'yes' to continue, or 'no' to cancel:"
send "yes"

However, the line ./testscript.sh get never executed because the collectstatic command before is waiting for input. How can I skip that ? I also tried leaving out the && but it didn't work.

Thanks in advance !


Solution 1:

You can try

python manage.py collectstatic --noinput

Solution 2:

Why not just send yes to the input of manage.py:

python manage.py collectstatic --settings=app.settings_mark <<<yes &&
./testscript.sh

Or:

echo yes | python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh