django织物syncdb [英] django fabric syncdb

查看:85
本文介绍了django织物syncdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您将如何运行此django命令以自动与结构同步db。

How would you run this django command to syncdb with fabric automatically.

python manage.py syncdb  --settings="app.settings.test"

如果尝试运行,它将卡在您想要创建超级用户帐户,是否可以按原样传递并使用它登录信息。

if tried to do run, it gets stuck at the "Do you want to create superuser account", can it passed as yes and login information with it.

run('python manage.py syncdb  --settings="app.settings.%s"' % name, pty=True)


推荐答案

在参数中添加-noinput ,以防止django-admin提示:

Add --noinput to the arguments to keep django-admin from prompting:

python manage.py syncdb --settings="app.settings.%s" --noinput

如果您有要始终预加载的特定凭据,我怀疑最简单的实现方法是使用(只是!)从计算机上创建用户数据库的数据转储。加载管理员帐户,然后在syncdb之后加载该帐户。另外,您可以简单地省去管理员帐户,然后在需要时使用 manage.py createsuperuser 添加它。

If you have specific credentials that you'd like to preload always, I suspect the simplest way to achieve that would be to create a data dump of the user database from a machine with (just!) the admin account loaded, and then to load that in after syncdb. Alternatively, you could simply leave out the admin account and add it later with manage.py createsuperuser when and if you need to have it.

这篇关于django织物syncdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆