14

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 !

2 Answers2

17

You can try

python manage.py collectstatic --noinput
Susaj S N
  • 281
  • 2
  • 5
7

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
muru
  • 193,181
  • 53
  • 473
  • 722
  • 8
    You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput http://stackoverflow.com/questions/8705305/automated-django-receive-hook-on-server-respond-to-collectstatic-with-yes – ptevans Nov 04 '16 at 00:34