automated django receive hook on server: respond to collectstatic with "yes"

DjangoGitHook

Django Problem Overview


I'm using a Github post-recieve hook to run a bash file that pulls both my repos.

#!/bin/sh
cd ~/public_html/repo_static
env -i /usr/bin/git pull origin master
cd ~/django-code/repo_django
env -i /usr/bin/git pull origin master

I also want to collectstatic on the django repo. How do I automate the "yes" response to that?

I can't use Fabric because unfortunately the team chose to work with Python 2.4 for the time being. Is there a way to automate collectstatic without Fabric?

Django Solutions


Solution 1 - Django

python manage.py collectstatic --noinput

Solution 2 - Django

If you'd like to specify the default answer, you could also just pipe it into the command:

$ echo yes | python manage.py collectstatic

or

$ echo no | python manage.py collectstatic

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionArtur SapekView Question on Stackoverflow
Solution 1 - DjangoTommaso BarbugliView Answer on Stackoverflow
Solution 2 - DjangoKrisView Answer on Stackoverflow