Kiwi备份恢复因python错误而失败

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kiwi备份恢复因python错误而失败相关的知识,希望对你有一定的参考价值。

我导出数据库json做这里解释的命令:http://kiwitcms.org/blog/atodorov/2018/07/30/how-to-backup-docker-volumes-for-kiwi-tcms/

我正在运行最新版的Kiwi。

  1. docker exec -it kiwi_web / bin / bash -c'/Kiwi/manage.py sqlflush | /Kiwi/manage.py dbshel​​l'

2.cat database.json | docker exec -i kiwi_web /Kiwi/manage.py loaddata --format json -

我收到此错误:

Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 564, in get_field
    return self.fields_map[field_name]
KeyError: 'description'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
    yield from PythonDeserializer(objects, **options)
  File "/venv/lib/python3.6/site-packages/django/core/serializers/python.py", line 116, in Deserializer
    field = Model._meta.get_field(field_name)
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 566, in get_field
sh-4.2$ cat database.json | ./manage.py loaddata --format json -
Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 564, in get_field
    return self.fields_map[field_name]
KeyError: 'description'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
    yield from PythonDeserializer(objects, **options)
  File "/venv/lib/python3.6/site-packages/django/core/serializers/python.py", line 116, in Deserializer
    field = Model._meta.get_field(field_name)
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 566, in get_field
    raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Classification has no field named 'description'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
    self.loaddata(fixture_labels)
  File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 113, in loaddata
    self.load_label(fixture_label)
  File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 168, in load_label
    for obj in objects:
  File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 73, in Deserializer
    raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture '-':
答案

您在哪个版本的Kiwi TCMS备份?

看起来备份来自旧版本,因为6.5附带了迁移,可以删除Build.description和Classification.description字段!

我不确定在技术上是否可以优雅地处理这个问题。请在GitHub上提交一个问题,以便我们调查更多细节并链接回此SO线程。

为您解决的问题是,不是推出最新版本的Kiwi TCMS,而是启动备份的版本。然后恢复数据,升级到最新版本,运行将更改数据库架构的迁移,然后再次备份。

如果您没有保留旧的docker镜像,则必须从源代码构建它。

以上是关于Kiwi备份恢复因python错误而失败的主要内容,如果未能解决你的问题,请参考以下文章

Python 7Zip 错误因扫描警告而失败

BigQuery 代码因使用 pandas python 客户端库的 MemoryError 而失败

python import dlib 因分段错误而失败

SwiftUI Preview 因链接器错误而失败

在 RestKit 中恢复网络时自动恢复因网络问题而失败的操作

google-cloud-sdk 安装因 python 语法错误而失败