Hello, I’ve bootstrap 5 installed :
(vitual_env) C:\test1>pip list
Package Version
asgiref 3.7.2
beautifulsoup4 4.12.3
Django 5.0.3
django-bootstrap5 23.4
mysqlclient 2.2.4
pillow 10.2.0
pip 24.0
soupsieve 2.5
sqlparse 0.4.4
tzdata 2024.1
(vitual_env) C:\test1>
When I try to use that, I’ve this error :
(vitual_env) C:\test1>py manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\threading.py”, line 1073, in _bootstrap_inner
self.run()
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\threading.py”, line 1010, in run
self._target(*self.args, **self.kwargs)
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py”, line 64, in wrapper
fn(*args, **kwargs)
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\commands\runserver.py”, line 125, in inner_run
autoreload.raise_last_exception()
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py”, line 87, in raise_last_exception
raise exception[1]
File "C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init.py", line 394, in execute
autoreload.check_errors(django.setup)()
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py”, line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django_init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\config.py”, line 193, in create
import_module(entry)
File "C:\Users\Johann\AppData\Local\Programs\Python\Python312\Lib\importlib_init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1387, in _gcd_import
File “”, line 1360, in _find_and_load
File “”, line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘bootstrap5’
My setting.py was configured :
INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘clt’,
‘bootstrap5’,
]
and this is my home.html :
> {% load bootstrap5 %}
> <!DOCTYPE html>
> <html data-bs-theme="light" lang="en">
>
> <head>
> <meta charset="utf-8">
> <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
> <title>Django First</title>
> {% bootstrap_css %}
> {% bootstrap_javascript %}
> </head>
>
> <body>
> <nav class="navbar navbar-expand-md bg-dark py-3" data-bs-theme="dark">
> <div class="container"><a class="navbar-brand d-flex align-items-center" href="#"><span class="bs-icon-sm bs-icon-rounded bs-icon-primary d-flex justify-content-center align-items-center me-2 bs-icon"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 16 16" class="bi bi-bezier">
> <path fill-rule="evenodd" d="M0 10.5A1.5 1.5 0 0 1 1.5 9h1A1.5 1.5 0 0 1 4 10.5v1A1.5 1.5 0 0 1 2.5 13h-1A1.5 1.5 0 0 1 0 11.5v-1zm1.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1zm10.5.5A1.5 1.5 0 0 1 13.5 9h1a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5v-1zm1.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1zM6 4.5A1.5 1.5 0 0 1 7.5 3h1A1.5 1.5 0 0 1 10 4.5v1A1.5 1.5 0 0 1 8.5 7h-1A1.5 1.5 0 0 1 6 5.5v-1zM7.5 4a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1z"></path>
> <path d="M6 4.5H1.866a1 1 0 1 0 0 1h2.668A6.517 6.517 0 0 0 1.814 9H2.5c.123 0 .244.015.358.043a5.517 5.517 0 0 1 3.185-3.185A1.503 1.503 0 0 1 6 5.5v-1zm3.957 1.358A1.5 1.5 0 0 0 10 5.5v-1h4.134a1 1 0 1 1 0 1h-2.668a6.517 6.517 0 0 1 2.72 3.5H13.5c-.123 0-.243.015-.358.043a5.517 5.517 0 0 0-3.185-3.185z"></path>
> </svg></span><span>Django First</span></a><button data-bs-toggle="collapse" class="navbar-toggler" data-bs-target="#navcol-5"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
> <div class="collapse navbar-collapse" id="navcol-5">
> <ul class="navbar-nav ms-auto">
> <li class="nav-item"><a class="nav-link active" href="#">Client</a></li>
> <li class="nav-item"><a class="nav-link" href="#">contact</a></li>
> <li class="nav-item"><a class="nav-link" href="#">info</a></li>
> </ul><a class="btn btn-primary ms-md-2" role="button" href="#">MENU</a>
> </div>
> </div>
> </nav>
> </body>
>
> </html>
I’ve try to unistall and install (pip install django-bootstrap5) but I’ve the same problems, I cant runserver
Thank you for your help