Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python &引用;django.db.utils.ProgrammingError:x字段不存在;在我删除模型字段后显示_Python_Django - Fatal编程技术网

Python &引用;django.db.utils.ProgrammingError:x字段不存在;在我删除模型字段后显示

Python &引用;django.db.utils.ProgrammingError:x字段不存在;在我删除模型字段后显示,python,django,Python,Django,我从我的Post模型中删除了total_comments字段。我在本地服务器上执行了migrate和makemigrations,将迁移文件推送到远程服务器,然后在那里也执行了migrate和makemigrations。但是,我现在在远程服务器终端中看到此错误: Traceback (most recent call last): File "/home/james/postr/env/lib/python3.5/site-packages/celery/app/trace.py", li

我从我的
Post
模型中删除了
total_comments
字段。我在本地服务器上执行了
migrate
makemigrations
,将迁移文件推送到远程服务器,然后在那里也执行了
migrate
makemigrations
。但是,我现在在远程服务器终端中看到此错误:

Traceback (most recent call last):
  File "/home/james/postr/env/lib/python3.5/site-packages/celery/app/trace.py", line 374, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/james/postr/env/lib/python3.5/site-packages/celery/app/trace.py", line 629, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/james/postr/post/tasks.py", line 18, in arrange_ads
    for ad in ads:
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 889, in execute_sql
    cursor.execute(sql, params)
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/james/postr/env/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/james/postr/env/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column post_post.total_comments does not exist
我在
myapp/post/migrations
中查看了我的迁移文件夹,它显示迁移文件肯定在那里:

class Migration(migrations.Migration):

    dependencies = [
        ('post', '0031_auto_20180804_0724'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='post',
            name='total_comments',
        ),
    ]

那么,为什么我仍然会遇到这个错误……有什么想法吗?

错误发生在我的芹菜任务上,该任务涉及处理我的
Post
模型(尽管芹菜任务文件没有处理
总注释

我重新启动了芹菜服务器,现在错误消失了