git 服务器上的自动 django 接收钩子:用“是”响应 collectstatic

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8705305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:18:42  来源:igfitidea点击:

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

djangogithook

提问by Artur Sapek

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

我正在使用 Github post-recieve hook 来运行一个 bash 文件来拉我的两个 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 collectstaticon the django repo. How do I automate the "yes" response to that?

我也想collectstatic在 django repo 上。我如何自动响应“是”?

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

我无法使用Fabric,因为不幸的是,团队暂时选择使用 Python 2.4。有没有办法在没有 Fabric 的情况下自动化 collectstatic?

回答by Tommaso Barbugli

python manage.py collectstatic --noinput

回答by Kris

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

如果您想指定默认答案,您也可以将其通过管道输入命令:

$ echo yes | ./manage.py collectstatic

or

或者

$ echo no | ./manage.py collectstatic