我从Post
模型中删除了字段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',
),
]
中的迁移文件夹,它表明该迁移文件肯定存在:
inline
那为什么我仍然会收到此错误...任何想法?
答案 0 :(得分:0)
我的celery任务发生错误,该错误涉及处理我的Post
模型(尽管celery任务文件对total_comments
没有任何作用)。
我重新启动了celery服务器,现在错误消失了。