我从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
模型(尽管芹菜任务文件没有对total_comments
做任何事情(。
我重新启动了芹菜服务器,现在错误已经消失了。