Search code examples
pythondjango-crispy-formsdjango-2.2

Django ModuleNotFoundError: No module named 'crispy_bootstrap5'


I am trying to import crispy_bootstrap5. I have activated my virtual environment after that I have update my requirements.txt in which it is installing crispy_bootstrap5 but getting error ModuleNotFoundError: No module named 'crispy_bootstrap5'

enter image description here

I have also try to install it with pip but it is giving that it is already installed.

Using Pycharm terminal

This is my part of my 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'

Any help will be appreciated


Solution

  • I was using docker to run my project with django container. so for that I had to follow this step to make it work.

    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