【问题标题】:django-background-tasks migrations on herokuheroku 上的 django-background-tasks 迁移
【发布时间】:2017-03-04 11:05:26
【问题描述】:

我正在尝试迁移托管在 heroku 中的应用程序上的 dajngo-background-tasks。迁移在本地正常工作,但是当我尝试运行时:

heroku run python manage.py migrate

它返回“没有要应用的迁移”

  1. 我已将“background_task”添加到 INSTALLED_APPS
  2. 我跑了

    heroku run python manage.py makemigrations background_task
    

    它创建了所需的迁移

  3. 我什至尝试过跑步

    heroku run python manage.py migrate background_task
    

    导致“CommandError:应用程序'background_task'没有迁移。”

PS:我注意到的一件事是,在本地运行迁移时,我得到了这个文本

Apply all migrations: admin, background_task, auth, contenttypes, sessions, <my_app>

但是当我在服务器上运行它时,我得到了

Apply all migrations: admin, auth, contenttypes, sessions, <my_app>

我们将不胜感激任何形式的帮助!

【问题讨论】:

    标签: django heroku migration background-task


    【解决方案1】:

    您不能通过 heroku run 运行 makemigrations。您必须在本地运行它,提交生成的迁移并将它们推送到 heroku,然后在那里运行它们。

    【讨论】:

    • 也这样做了。不工作。仍然说“没有要申请的迁移”。尝试运行 process_tasks 以确保在 background_task 未迁移时仍然出现相同的旧错误。基本上是 'column background_task.verbose_name does not exist LINE 1: ...sk"."task_params", "background_task"."task_hash", "backgroun...'
    • 编辑:得出的结论是进行了一些有关 background_task 的迁移,但是当我运行“heroku run python manage.py process_tasks”时,它向我显示了这个错误“列 background_task.verbose_name 不存在 LINE 1: ...sk"."task_params", "background_task"."task_hash", "backgroun...'
    【解决方案2】:

    这是由于 django-background-tasks 包中缺少迁移。此问题已在最新版本中修复。如果您安装 1.1.9,则部署到 heroku 应该可以工作。

    【讨论】:

      猜你喜欢
      • 2015-08-29
      • 2022-08-10
      • 2018-10-23
      • 2014-07-21
      • 2021-01-13
      • 2021-03-23
      • 2021-11-29
      • 1970-01-01
      • 2015-05-16
      相关资源
      最近更新 更多