manage.py标志强制无人值守命令?

时间:2014-04-21 17:53:14

标签: python django django-manage.py

我正在阅读本教程:Installing and Configuring Graphite and Statsd on an Ubuntu 12.04 VPS

我正在努力实现一切可能的自动化,然后本教程中有一步让我发疯:

  

接下来,我们将配置Graphite数据库。转到Graphite   webapp目录并运行数据库脚本:

cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb

如您所见,我们必须运行manage.py,当我运行syncdb时询问是否创建了超级用户。我怎么能避免这种情况?我想运行这些发送所有参数来制作自动脚本。

有什么想法吗?

1 个答案:

答案 0 :(得分:7)

您可以使用the --noinput argument停用the syncdb command的提示。

  

--noinput

     

使用--noinput选项取消所有用户提示,例如“您确定吗?”确认消息。如果django-admin.py作为无人参与的自动脚本执行,则此功能非常有用。