python - 关系 "background_task"不存在

标签 python django

我正在尝试在运行 django 服务器时在后台运行一些任务。为此,我使用后台任务库。我已按照以下步骤操作:

  1. pip install django-background-tasks
  2. settings.pyINSTALLED_APPS 中添加了'background_task'
  3. python manage.py makemigrations background_task

问题出现在第三步,给出错误说明:

django.db.utils.ProgrammingError: relation "background_task" does not exist LINE 1: INSERT INTO "background_task" ("task_name", "task_params", "...

我尝试寻找其他解决方案,但每个解决方案都是第三行。

我应该如何进行?

最佳答案

我不知道这是否仍然是有效的问题,但对我有帮助的是恢复与 background_task 模块相关的代码中的所有更改,然后应用迁移。之后重新应用代码中的更改,一切都应该有效。

关于python - 关系 "background_task"不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56949235/

相关文章:

python - 正则表达式将字母数字与特殊字符匹配

python - 在 Python 中向量化重复的数学函数

python - 使用 python 连接到 surfshark vpn

python - Django 管理模型继承可能吗?

python - Django 不在 Internet Explorer 中存储 session cookie

django - 高级 Django 查询

python - TemplateDoesNotExist 错误(Python 3.6.1、Django 1.11.1、PyCharm)

python - 如何在 Python 的 Bokeh 图中扩展有限的调色板

使用 ImageGrab 的 Python 屏幕记录

python - PyCharm Vagrant 无法刷新远程解释器的骨架