django-crispy-forms报错说bootstrap4/uni_form.html 模板不存在

报错截图

file

按照如下步骤解决:

1、补充一个安装包

pip install django-crispy-forms

pip install crispy-bootstrap4

2、给INSTALLED_APPS新增一项

INSTALLED_APPS = [
 ...,
'crispy_forms',
'crispy_bootstrap4',
 ]

3、给settings.py中添加配置项

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap4"
CRISPY_TEMPLATE_PACK = "bootstrap4"

技术文章地址:
https://stackoverflow.com/questions/65238459/templatedoesnotexist-at-users-register-bootstrap5-uni-form-html

Leave a Comment