在构建静态之后,我尝试让grunt exec
执行django
collectstatic
命令。所以,在我看来Gruntfile.js文件我有:
grunt.initConfig({
...
exec: {
collectstatic: {
cwd: '../../',
cmd: 'python manage.py collectstatic --clear'
}
}
...
}
当我尝试用grunt exec:collectstatic --verbose
执行此命令时,它不会诅咒,但会冻结以下输出:
Running "exec:collectstatic" (exec) task
Verifying property exec.collectstatic exists in config...OK
File: [no files]
python manage.py collectstatic --clear
Expecting exit code 0
看起来好像它没有从django
接收退出代码。我检查了一下,如果django返回正确的状态码,并且它似乎是这样做的:
$ python manage.py collectstatic --clear
$ echo $?
0
怎么了?你知道吗
默认情况下,django的collectstatic命令需要用户输入(确认确实应该收集静态文件),但grunt无法将用户的输入传递到collectstatic命令中。这将导致冻结,因为collectstatic期望输入中有内容,而grunt没有提供任何内容。你知道吗
可以通过在collectstatic命令中添加
noinput
参数来更改它,因此整个命令如下所示:这会解决你的问题。你知道吗
相关问题 更多 >
编程相关推荐