当还涉及迁移时,如何使用 django 进行同步数据库
当我执行syncdb时,我每次都会收到以下错误:
Not synced (use migrations): - deals - analytics (use ./manage.py migrate to migrate these)
当我运行 sudo python manage.py migrate 时。我得到以下信息
Running migrations for deals: - Nothing to migrate. - Loading initial data for deals. No fixtures found. Running migrations for analytics: - Nothing to migrate. - Loading initial data for analytics. No fixtures found.
我非常感谢您的帮助
when I do a syncdb I get the following error everytime:
Not synced (use migrations): - deals - analytics (use ./manage.py migrate to migrate these)
And when I run sudo python manage.py migrate. I get the following
Running migrations for deals: - Nothing to migrate. - Loading initial data for deals. No fixtures found. Running migrations for analytics: - Nothing to migrate. - Loading initial data for analytics. No fixtures found.
I highly appreciate your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从输出来看,数据库似乎已经与迁移同步。不存在有问题的错误。 (尽管您不应该真正成为 root 来运行迁移。)
如果您正在考虑创建更多迁移,请使用 south Documentation,通常只是在修改模型后运行以下命令:
然后使用
python manage.py migrate
来应用更改。From the output, it seems like the database is already synchronized with the migrations. There are no problematic errors. (Although you shouldn't really be root to run the migrations.)
If you're looking into creating more migrations, use the south documentation, which usually is just running the following after you modify the models:
And then use
python manage.py migrate
to apply the changes.看起来迁移已经通过了。检查数据库中的 South_migationhistory 表。
如果您想为具有迁移的应用程序同步新数据库,只需在 settings.py 中禁用南。
It looks like migrations have been already passed. Check south_migationhistory table in db.
If you want to sync new db for apps which has migrations just disable south in settings.py.
您是否已初步运行架构迁移?
如果出现错误,数据库已经存在,请执行以下操作:
Have you ran a schemamigration initial yet?
if you get the error, db already excists do this: