繁体   English   中英

如何处理 Django 项目中的迁移(数字海洋应用平台)?

[英]How to handle migrations in Django project in production (Digital Ocean App Platform)?

我已经使用该应用平台将近 2 个月了。 昨天,我在我的 Django 项目中对数据库表(模型)进行了一些更改。 我将这些更改推送到 Github 并且我的应用程序成功重新部署。 但是当我打开该站点时,我收到“ProgrammingError”,表明我在现有表中新建的某些字段不存在。 因此,我在 App Platform 中打开了控制台并应用了迁移,但没有任何改变。 我仍然面临错误。

这是完整的回溯:

回溯(最后一次调用):文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py”,第 84 行,在 _execute return self.cursor.execute (sql,参数)

上述异常(列 products_subcategory.description 不存在 LINE 1: ...subcategory"."id", "products_subcategory"."name", "products_... ^ )是以下异常的直接原因:文件" /workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py”,第 47 行,内部响应 = get_response(request) 文件“/workspace/.heroku/python/ lib/python3.9/site-packages/django/core/handlers/base.py”,第 181 行,在 _get_response response = Wrapped_callback(request, *callback_args, **callback_kwargs) 文件“/workspace/.heroku/python/lib /python3.9/site-packages/django/views/generic/base.py”,第 70 行,在视图中返回 self.dispatch(request, *args, **kwargs) 文件“/workspace/.heroku/python/lib /python3.9/site-packages/django/views/generic/base.py”,第 98 行,在调度返回处理程序(请求,*args,**kwargs)文件“/workspace/lavsco/views.py”,行40、在get return render(request, 'lavisco/index.html', context) File "/workspace/.heroku/python/lib/python3.9 /site-packages/django/shortcuts.py”,第 19 行,在渲染内容 = loader.render_to_string(template_name, context, request, using=using) 文件“/workspace/.heroku/python/lib/python3.9/site -packages/django/template/loader.py”,第 62 行,在 render_to_string 返回 template.render(context, request) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/ backends/django.py”,第 61 行,在渲染中返回 self.template.render(context) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 170 行,在渲染中返回 self._render(context) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 162 行,在 _render 中返回 self.nodelist .render(context) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 938 行,在渲染位 = node.render_annotated(context) 文件中“/ workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 905 行,在 render_annotated 返回 self.ren der(context)文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader_tags.py”,第150行,在渲染返回compiled_parent._render(context)文件“/workspace/ .heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 162 行,在 _render 返回 self.nodelist.render(context) 文件“/workspace/.heroku/python/lib/ python3.9/site-packages/django/template/base.py",第 938 行,在渲染位 = node.render_annotated(context) 文件"/workspace/.heroku/python/lib/python3.9/site-packages/ django/template/base.py”,第 905 行,在 render_annotated 返回 self.render(context) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader_tags.py”,第 192 行,在渲染中返回 template.render(context) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 172 行,在渲染中返回 self._render (上下文)文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 162 行,在 _render 返回 self.node list.render(context) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 938 行,在渲染位 = node.render_annotated(context) 文件中“ /workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py”,第 905 行,在 render_annotated 返回 self.render(context) 文件“/workspace/.heroku/python/lib /python3.9/site-packages/django/template/defaulttags.py”,第 311 行,如果匹配,则在渲染中:文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/ models/query.py”,第 291 行,在bool self._fetch_all() 文件中“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py”,第 1308 行,在 _fetch_all self._result_cache = list(self._iterable_class(self)) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py”,第 53 行,在迭代结果 = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/sql /compiler.py”,第 1156 行,在 execute_sql cursor.execute(sql, params) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py”中,第 98 行,在执行 return super().execute(sql, params) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py”中,第 66 行,在执行中返回 self._execute_with_wrappers(sql, params, many=False, executor=self._execute) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py ”,第 75 行,在 _execute_with_wrappers 返回执行程序(sql,params,many,context)文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py”,行84,在 _execute return self.cursor.execute(sql, params) 文件“/workspace/.heroku/python/lib/python3.9/site-packages/django/db/utils.py”,第90行,在exit raise dj_exc_value.with_traceback(traceback) 来自 exc_value 文件“/workspace/.heroku/python/lib/python3.9/site-packag es/django/db/backends/utils.py",第 84 行,在 _execute 中返回 self.cursor.execute(sql, params)

异常类型:ProgrammingError at / 异常值:列 products_subcategory.description 不存在第 1 行:...subcategory"."id", "products_subcategory"."name", "products_...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM