修复生产环境 postgres.E005:INSTALLED_APPS 缺少 django.contrib.postgres

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 个用例全部通过。
This commit is contained in:
2026-09-11 10:57:20 +08:00
parent 1686794ad7
commit 097b16eb09
+5
View File
@@ -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 读取,