Django ModuleNotFoundError: No module named 'crispy_bootstrap5'
Django ModuleNotFoundError: No module named 'crispy_bootstrap5'
我正在尝试导入 crispy_bootstrap5。
之后我激活了我的虚拟环境,我更新了我的 requirements.txt 并在其中安装了 crispy_bootstrap5 但出现错误 ModuleNotFoundError: No module named 'crispy_bootstrap5'
我也尝试用 pip 安装它,但它显示它已经安装了。
这是我的一部分 settings.py:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
'crispy_bootstrap5',
)
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap5'
CRISPY_TEMPLATE_PACK = 'bootstrap5'
任何帮助将不胜感激
需要将crispy_forms添加到installed_apps中:
INSTALLED_APPS = (
...
"crispy_forms",
"crispy_bootstrap5",
...
)
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"
阅读官方文档:https://github.com/django-crispy-forms/crispy-bootstrap5
我使用 docker 来 运行 我的项目和 django 容器。所以为此我必须按照这一步来让它工作。
docker ps
docker exec -it <docker_id_for_django_container> /bin/bash or docker exec -it <docker_id_for_django_container> /bin/sh
pip install -r requirements.txt
pip install crispy-bootstrap5
这对我有用
我正在与 Docker 合作,这对我有用:
docker-compose exec web pip install crispy_bootstrap5
还想提一下,如果您正在关注 Django 专业版,请参考:https://github.com/wsvincent/djangoforprofessionals
我正在尝试导入 crispy_bootstrap5。
之后我激活了我的虚拟环境,我更新了我的 requirements.txt 并在其中安装了 crispy_bootstrap5 但出现错误 ModuleNotFoundError: No module named 'crispy_bootstrap5'
我也尝试用 pip 安装它,但它显示它已经安装了。
这是我的一部分 settings.py:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
'crispy_bootstrap5',
)
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap5'
CRISPY_TEMPLATE_PACK = 'bootstrap5'
任何帮助将不胜感激
需要将crispy_forms添加到installed_apps中:
INSTALLED_APPS = (
...
"crispy_forms",
"crispy_bootstrap5",
...
)
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"
阅读官方文档:https://github.com/django-crispy-forms/crispy-bootstrap5
我使用 docker 来 运行 我的项目和 django 容器。所以为此我必须按照这一步来让它工作。
docker ps
docker exec -it <docker_id_for_django_container> /bin/bash or docker exec -it <docker_id_for_django_container> /bin/sh
pip install -r requirements.txt
pip install crispy-bootstrap5
这对我有用
我正在与 Docker 合作,这对我有用:
docker-compose exec web pip install crispy_bootstrap5
还想提一下,如果您正在关注 Django 专业版,请参考:https://github.com/wsvincent/djangoforprofessionals