python - Django collectstatic --no input Yes 而不是 no

标签 python django makefile

我正在使用 Django3,目前我的 makefile 中有以下用于“构建”的命令

python3 manage.py collectstatic 

为了使用管道自动化我的构建过程,我想摆脱询问的提示

You have requested to collect static files at the destination location as specified in your settings:

URL

This will overwrite existing files! Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel

我发现我可以在最后为 collectstatic 添加“--no-input”,但在这种情况下这将回答“否”。 有没有办法让脚本默认回答"is"?

最佳答案

如 Django 文档中所述:

在随后的 collectstatic 运行中(如果 STATIC_ROOT 不为空),仅当文件的修改时间戳大于 STATIC_ROOT 中文件的时间戳时,才会复制文件。

所以默认情况下,django 会在 collectstatic 命令上覆盖您修改过的文件,--noinput 标志意味着它不会请求您的许可。

关于python - Django collectstatic --no input Yes 而不是 no,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66679629/

相关文章:

python - 带网格搜索的火车

python - 带有 redis 代理可见性超时的 celery

django - PyCharm 2.5 TestRunner 无法导入特定模块

python - 有时脚本闲置,需要我按 RETURN 才能解锁它们 - Python

c++ - 如何修复 `cmake .. && make install` "No rule to make target install"?

image - 如何使用带有 Inkscape 的 Makefile 保存为 "Plain SVG"

linux - 如何将参数从 makefile 传递到 Linux 内核模块源代码

python - 比较两个变量是否在python中引用同一个对象

python - key 错误 : 'cross' when trying to do cartesian product with merge()

python - 为什么数据从 sqlite 数据库到 django 模板不同(制表符空格被删除)?