postgres_search update_index

时间:2019-07-12 17:22:34

标签: python django postgresql wagtail

我正在将我的网站从wagtail 1.10/django 1.11/python 2.7迁移到wagtail 2.5.1/django 2.2.3/python 3.7。我一直在使用the postgres_search后端。

postgres_search外,我的所有表均已成功迁移。为了使事情在我的开发机上正常工作,我必须删除postgres_search表,重新运行postgres_search迁移,然后运行update_index。在服务器上,我做同样的事情,但是update_index抛出异常。我的机器之间的主要区别是我在开发机器上运行Postgres 11,并在服务器上停留在9.4上。

无论什么原因导致此问题,也是(我认为)每当我尝试在服务器上保存对页面的任何更改时都会导致TransactionManagementError。如果我在服务器上使用默认的数据库搜索后端,则一切正常。

我想知道我的问题是否可能与这张django票有关:

https://code.djangoproject.com/ticket/30446

任何建议将不胜感激。

这是我的追踪记录:

(venv) [aapa@web552 physanth2]$ python3.7 aapa/manage.py update_index
Updating backend: default
default: Rebuilding index physanth
default: physanth.StandardIndexPage Traceback (most recent call last):
  File "aapa/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/wagtail/search/management/commands/update_index.py", line 125, in handle
    schema_only=options.get('schema_only', False), chunk_size=options.get('chunk_size')
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/wagtail/search/management/commands/update_index.py", line 87, in update_backend
    index.add_items(model, chunk)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/wagtail/contrib/postgres_search/backend.py", line 180, in add_items
    update_method(content_type_pk, objs)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/wagtail/contrib/postgres_search/backend.py", line 164, in add_items_update_then_create
    self.entries.bulk_create(to_be_created)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/query.py", line 474, in bulk_create
    ids = self._batched_insert(objs_without_pk, fields, batch_size, ignore_conflicts=ignore_conflicts)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1204, in _batched_insert
    ignore_conflicts=ignore_conflicts,
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1186, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1334, in execute_sql
    for sql, params in self.as_sql():
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1291, in as_sql
    placeholder_rows, param_rows = self.assemble_as_sql(fields, value_rows)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1258, in assemble_as_sql
    placeholder_rows, param_rows = zip(*sql_and_param_pair_rows)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1254, in <genexpr>
    sql_and_param_pair_rows = (zip(*row) for row in rows_of_fields_as_sql)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1248, in <genexpr>
    (self.field_as_sql(field, v) for field, v in zip(fields, row))
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1180, in field_as_sql
    sql, params = self.compile(val)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 405, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/contrib/postgres/search.py", line 78, in as_sql
    ) for expression in clone.get_source_expressions()
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/contrib/postgres/search.py", line 78, in <listcomp>
    ) for expression in clone.get_source_expressions()
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/aapa/webapps/physanth2/venv/lib/python3.7/site-packages/django/db/models/expressions.py", line 261, in output_field
    raise FieldError('Cannot resolve expression type, unknown output_field')
django.core.exceptions.FieldError: Cannot resolve expression type, unknown output_field

这是点子冻结:

asgiref==3.1.4
beautifulsoup4==4.6.0
bleach==3.1.0
certifi==2019.6.16
chardet==3.0.4
Django==2.2.3
django-bootstrap-form==3.4
django-modelcluster==4.4
django-ranged-response==0.2.0
django-simple-captcha==0.5.11
django-taggit==0.24.0
django-treebeard==4.3
djangorestframework==3.9.4
draftjs-exporter==2.1.6
html5lib==1.0.1
idna==2.8
lxml==4.3.4
Pillow==5.4.1
psycopg2==2.8.3
pytz==2019.1
requests==2.22.0
six==1.12.0
sqlparse==0.3.0
Unidecode==1.1.1
urllib3==1.25.3
wagtail==2.5.1
webencodings==0.5.1
Willow==1.1

0 个答案:

没有答案
相关问题