当还涉及迁移时,如何使用 django 进行同步数据库

发布于 2024-12-13 13:15:29 字数 442 浏览 2 评论 0原文

当我执行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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

洋洋洒洒 2024-12-20 13:15:29

从输出来看,数据库似乎已经与迁移同步。不存在有问题的错误。 (尽管您不应该真正成为 root 来运行迁移。)

如果您正在考虑创建更多迁移,请使用 south Documentation,通常只是在修改模型后运行以下命令:

python manage.py schemamigration --auto <APP>

然后使用 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:

python manage.py schemamigration --auto <APP>

And then use python manage.py migrate to apply the changes.

夜血缘 2024-12-20 13:15:29

看起来迁移已经通过了。检查数据库中的 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.

千纸鹤 2024-12-20 13:15:29

您是否已初步运行架构迁移?

./manage.py schemamigration deals --initial
./manage.py migrate deals

如果出现错误,数据库已经存在,请执行以下操作:

./manage.py schemamigration deals --initial
./manage.py migrate deals --fake

Have you ran a schemamigration initial yet?

./manage.py schemamigration deals --initial
./manage.py migrate deals

if you get the error, db already excists do this:

./manage.py schemamigration deals --initial
./manage.py migrate deals --fake
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文