我一直在研究Django应用程序,最近遇到了一些问题,推动更新并将数据库设置从Local迁移到Heroku。
我按照以下步骤操作:
python manage.py makemigrations
python manage.py migrate
。 git push heroku master
w / Heroku CLI heroku run python manage.py migrate
不幸的是,这并未将我所做的相应更新迁移到本地开发环境中的数据库设置。我收到的错误消息是“X-app中不存在列x”。 我最终暂时恢复到我之前在model.py中的设置,但我想最终在我的数据库中添加新列。
此时,我正在尝试评估问题的最佳解决方案。我已经回顾了其他几个Stack Overflow问题,但还没有找到一个对我有用的问题。奇怪的是,我能够在以前的Heroku部署中成功迁移。
任何人提出的任何提示都将非常感激。作为参考,我使用的是Python 3.6.2和Django 1.11
Traceback:
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
The above exception (column courts_court.draft does not exist
LINE 1: ...urts_court"."address", "courts_court"."location",
"courts_co...) was the direct cause of the following exception:
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/courts/views.py" in court_list
128. return render(request, "court_list.html", context)
File "/app/.heroku/python/lib/python3.6/site-packages/django/shortcuts.py" in render
67. template_name, context, request=request, using=using)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/loader.py" in render_to_string
97. return template.render(context, request)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/backends/django.py" in render
95. return self.template.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render
206. return self._render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in _render
197. return self.nodelist.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render
988. bit = node.render_annotated(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render_annotated
955. return self.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/loader_tags.py" in render
173.return compiled_parent._render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in _render
197. return self.nodelist.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render
988. bit = node.render_annotated(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render_annotated
955. return self.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/loader_tags.py" in render
69. result = block.nodelist.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render
988. bit = node.render_annotated(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/base.py" in render_annotated
955. return self.render(context)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/template/defaulttags.py" in render
168.len_values = len(values)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/core/paginator.py" in __len__
117. return len(self.object_list)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/models/query.py" in __len__
240. self._fetch_all()
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/models/query.py" in _fetch_all
1074. self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/models/query.py" in __iter__
52. results = compiler.execute_sql()
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/models/sql/compiler.py" in execute_sql
852. cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/utils.py" in __exit__
95. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/app/.heroku/python/lib/python3.6/site-
packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /courts/
Exception Value: column courts_court.draft does not exist
LINE 1: ...urts_court"."address", "courts_court"."location",
"courts_co...`