crash after installation of bootstrap3

after sucessfully jnstalled Bootstrap3 and making succesfully change and test on base.html , the system break down ,It ’ not possible to start the runserver.
the directory setting is :

The templates are :

the settings.py is located in : (ll_env) C:\learning_log\learning_log>

Django settings for learning_log project.

Generated by 'django-admin startproject' using Django 4.2.7.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os
from pathlib import Path




# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-%)a543smid&l1&&=h&&wu69bozkz3*hl()$7b5ip6&1!4v7%*='

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

APPEND_SLASH = True       # add by alain

# Application definition

INSTALLED_APPS = (
 
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'bootstrap3',                   # Third party apps 15/02/2024
    'learning_logs',                # add by alain
    'users',                         # add the 5/03/2024
)

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
   
]

ROOT_URLCONF = 'learning_log.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
     #   'DIRS': [],
         'DIRS': [BASE_DIR / 'templates/learning_logs'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'learning_log.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# My setting

LOGIN_URL = 'users/login'

#settings for django-bootstrap3
BOOTSTRAP = {
    'include_jquery': True,
}

The runserver give tthe following error


(ll_env) C:\learning_log>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\learning_log\ll_env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\learning_log\ll_env\Lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "C:\learning_log\ll_env\Lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\learning_log\ll_env\Lib\site-packages\django\core\management\__init__.py", line 394, in execute
    autoreload.check_errors(django.setup)()
  File "C:\learning_log\ll_env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\learning_log\ll_env\Lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\learning_log\ll_env\Lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\learning_log\ll_env\Lib\site-packages\django\apps\config.py", line 193, in create
    import_module(entry)
  File "C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'learning_logs'

the package installed are


(ll_env) C:\learning_log>pip list
Package           Version
----------------- -------
asgiref           3.7.2
Django            4.2.7
django-bootstrap3 23.6
pip               23.3.1
setuptools        65.5.0
sqlparse          0.4.4
tzdata            2023.3

the path is :

(ll_env) C:\learning_log>path
PATH=C:\learning_log\ll_env\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\bin;C:\Python39\Scripts\;C:\Python39\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\;C:\Ruby27-x64\bin;C:\Users\EALALIN\AppData\Local\Microsoft\WindowsApps;C:\Users\EALALIN\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\EALALIN\.dotnet\tools;C:\Users\EALALIN\AppData\Local\Microsoft\WindowsApps;C:\Users\EALALIN\AppData\Local\GitHubDesktop\bin;C:\Users\EALALIN\.dotnet\tools;C:\Users\EALALIN\AppData\Roaming\npm

some more info’s

>>> DEBUG = True
>>>
>>> ALLOWED_HOSTS = []
>>>
>>> APPEND_SLASH = True
>>> INSTALLED_APPS = (
...
...     'django.contrib.admin',
...     'django.contrib.auth',
...     'django.contrib.contenttypes',
...     'django.contrib.sessions',
...     'django.contrib.messages',
...     'django.contrib.staticfiles',
...     'bootstrap3',                   # Third party apps 15/02/2024
...     'learning_logs',                # add by alain
...     'users',                         # add the 5/03/2024
... )
>>>
>>> MIDDLEWARE = [
...     'django.middleware.security.SecurityMiddleware',
...     'django.contrib.sessions.middleware.SessionMiddleware',
...     'django.middleware.common.CommonMiddleware',
...     'django.middleware.csrf.CsrfViewMiddleware',
...     'django.contrib.auth.middleware.AuthenticationMiddleware',
...     'django.contrib.messages.middleware.MessageMiddleware',
...     'django.middleware.clickjacking.XFrameOptionsMiddleware',
...
... ]
>>>
>>> ROOT_URLCONF = 'learning_log.urls'
>>>
>>> TEMPLATES = [
...     {
...         'BACKEND': 'django.template.backends.django.DjangoTemplates',
...      #   'DIRS': [],
...          'DIRS': [BASE_DIR / 'templates/learning_logs'],
...         'APP_DIRS': True,
...         'OPTIONS': {
...             'context_processors': [
...                 'django.template.context_processors.debug',
...                 'django.template.context_processors.request',
...                 'django.contrib.auth.context_processors.auth',
...                 'django.contrib.messages.context_processors.messages',
...             ],
...         },
...     },
... ]
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
NameError: name 'BASE_DIR' is not defined
>>>
>>> WSGI_APPLICATION = 'learning_log.wsgi.application'
>>>
>>>
>>>
>>>
>>> exit(0)

the data dase for the entry Topic and Entry are :

if yiu have any idee of what is happen they are the welcome .
Thanks in advance

You have a number of files in the wrong directory.

The asgi.py, settings.py, urls.py and wsgi.py should be in the “inner” learning_log directory, not the “outer” one.

(That’s learning_log, not learning_logs. Those files do not belong in learning_logs.)

Isee the following

There are 3 consecutive subdirectory c:\learning_log\learning_log\learning_log
and the file from the 3de one is out dated
at the first C:\learning_log I have information’s included the Sqlite3 and the subdirectory \users

The second one c:\learning_log\learning_log\

I have file updated wsgi.py, setting.py, asgi.py, init.py, and the file from the subdir \leaning_logs

the thirth one c:\learning_log\learning_log\learning_log
the file are outdated
except the pycache

image

but in the same level the subdir c:\learning_log\learning_log\learning_logs have well recent files

all of them are in a virtual envitonment

Thankx for your fast support
Alain

On the first view I thing that I have to copy all the files and file from subdir from
c:\learning_log\learning_log\learning_logs and pas them to
c:\learning_log\learning_logs*.*

Due the amount of work done , I will be carrefull and try it in this way , if you have other informations about it just tell me .

thank Alain

Yes.

Your directory c:\learning_log should contain the directories learning_log and learning_logs, and the manage.py file. (It may also contain your db.sqlite3 if you’re using it as your database.)

The c:\learning_log directory is what I refer to as the “outer” learning_log.

The c:\learning_log\learning_log directory is the “inner” learning_log.

The “inner” learning_log should not have any directories in it, other than possibly a __pycache__ directory.

It should basically look like this:

c:\learning_log
    learning_log
        __init__.py
       asgi.py
       wsgi.py
       urls.py
       settings.py
    learning_logs
        __init__.py
        apps.py
        urls.py
        views.py
        models.py
        admin.py
        (etc)

Once you’ve got the directory structure straightened out and the excess files and directories deleted, we can continue working on trying to get the root issue resolved.

I have endly choise to put a backup back.
It work again.

Thankx for your support
Regards alain