【问题标题】:Heroku git push Django migration failure for DuplicateTableHeroku git push DuplicateTable 的 Django 迁移失败
【发布时间】:2021-05-17 02:55:17
【问题描述】:

背景

将 Django 应用程序从 Digital Ocean 迁移到 Heroku。我在迁移数据时遇到了问题,所以我使用 pg_dump 来获取每个表的架构和数据。然后在heroku中运行这些脚本。我加载了我的网站,我可以看到新数据正在通过。

问题

现在,当我使用自动运行部署的 Heroku CLI 推送新代码时,它会因此失败:psycopg2.errors.DuplicateTable: relation "django_content_type" already exists

我运行的命令是

git add .
git commit -m "some message"
git push heroku master"

Procfile 具有运行命令的 release: python manage.py migrate,我曾想过将其删除,但当我将来要运行迁移时,这会导致问题。

有什么想法吗?

【问题讨论】:

    标签: django heroku heroku-postgres heroku-cli


    【解决方案1】:

    这让我今天早上掉进了一个兔子洞,我想通了。由于找不到类似的问题,所以我将把这个问题留出来。

    问题归结为本地和远程迁移不同步。按照这篇文章的最佳答案的说明解决了这个问题:Django Heroku Error "Your models have changes that are not yet reflected in a migration"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-21
      • 1970-01-01
      • 2021-05-19
      • 2015-06-26
      • 2023-01-31
      • 2013-09-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多