You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装django-crispy-forms后启动服务器报错:No module named 'crispy_bootstrap5accounts'

Django启动报错:ModuleNotFoundError: No module named 'crispy_bootstrap5accounts'

我刚安装了django-crispy-forms和crispy-bootstrap5,按照官方文档修改了settings.py文件,但执行python manage.py runserver启动服务器时,出现上述错误。我已经在网上搜索过解决方案,但未找到有效办法。

已尝试的配置如下:

INSTALLED_APPS配置:

INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"crispy_forms", # new
"crispy_bootstrap5", # new
]

Crispy相关配置:

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"

解决建议:

  • 全局排查项目中所有出现crispy_bootstrap5accounts的位置,这是明显的拼写错误,正确名称应为crispy_bootstrap5:
    • 检查所有配置文件(包括settings.py及其他扩展配置)是否误将crispy_bootstrap5accounts加入INSTALLED_APPS
    • 检查模板文件中的加载标签,比如是否写成了{% load crispy_bootstrap5accounts_tags %},需改为{% load crispy_bootstrap5_tags %}或{% load crispy_forms_tags %}
  • 验证虚拟环境中是否正确安装了crispy-bootstrap5,执行pip list查看,未安装则重新执行pip install crispy-bootstrap5
  • 清理Django缓存:python manage.py clearcache,再重启服务器

内容的提问来源于stack exchange,提问作者Natnael Alemayehu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 13:42:45