From 097b16eb09cdf57ac59841e07b0a60f6a431b61a Mon Sep 17 00:00:00 2001 From: Zhengen TANG Date: Fri, 11 Sep 2026 10:57:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=9F=E4=BA=A7=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=20postgres.E005=EF=BC=9AINSTALLED=5FAPPS=20=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=20django.contrib.postgres?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PostgreSQL 后端下,wagtailsearch.IndexEntry 模型会使用 SearchVectorField/ GinIndex 等 postgres 专属字段/索引类型,必须启用 django.contrib.postgres 才能通过 Django system check。dev 环境用 SQLite 不受影响,故只在 wagtailcms/settings/production.py 追加该 app。 验证:dev settings(sqlite)manage.py check 仍只有已知 treebeard.E001 警告; pytest 67 个用例全部通过。 --- wagtailcms/settings/production.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wagtailcms/settings/production.py b/wagtailcms/settings/production.py index 8c8ffa2..cce2693 100644 --- a/wagtailcms/settings/production.py +++ b/wagtailcms/settings/production.py @@ -8,6 +8,11 @@ DATABASES = { "default": env.db("DATABASE_URL"), } +# PostgreSQL 后端下,wagtailsearch.IndexEntry 会使用 SearchVectorField/GinIndex +# 等 postgres 专属字段/索引类型,必须启用 django.contrib.postgres 才能通过 +# system check(postgres.E005)。dev 环境用 SQLite,不需要这个 app。 +INSTALLED_APPS = [*INSTALLED_APPS, "django.contrib.postgres"] + # 生产环境邮件发送(线索通知邮件、PIPL 数据删除确认邮件均依赖此配置,见 apps/forms/views.py)。 # dev.py 用的是 console backend(打印到终端),生产环境必须换成真实 SMTP,否则邮件静默发送失败 # (send_mail 调用处未加 fail_silently,连接失败会抛异常;发信人账号密码等敏感信息只从 .env 读取,