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 :