D:\ecommerce
KenWhitesell:
You might also want to verify if the directory name is “ECOMMERCE” or “ecommerce”, and whether you’re running this on a file system where case-sensitivity is important.
The directory I created was “ECOMMERCE” but my “BASE_DIR” shows “ecommerce". I’m using Windows 10 O.S which uses the default file system NTFS.
KenWhitesell:
Also, how are you running this? Are you running this from the command line or in PowerShell? Is your venv active when you run this?
I’m using VSCode and tried running on both command line and in PowerShell options available.
KenWhitesell:
It may be helpful at this point if you were to post your complete settings file.
from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-6yc5(cv#n-)ihv*#k*g_)7#@92r!f5v)m(&k8%o**#j_b46yd9'
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'store',
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 = 'core.urls'
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR, '/templates'],
'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 = 'core.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
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',
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
STATIC_URL = 'static/'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
Thank you.
Ok, this definitely isn’t right. You’re creating a list with two options - BASE_DIR and ‘/templates’, neither one is the location of your template file.
It should either be ['templates'] or [os.path.join(BASE_DIR, 'templates')]
Abhi108:
I’m using VSCode and tried running on both command line and in PowerShell options available.
Try running it from a separate command line window where you can verify that the correct directory is the current directory and that the right virtual env is active. There may be a configuration issue with your VS Code launch.json file.
KenWhitesell:
Try running it from a separate command line window where you can verify that the correct directory is the current directory and that the right virtual env is active. There may be a configuration issue with your VS Code launch.json file.
Thank you sir, It is working now.
The mistake was that ‘store’ was not containing the ‘home.html’. They were at the same level(meaning in the same folder).
Now I changed it as follows:
Thank You for your valuable time Sir, I have learnt a lot from you. I hope I will be able to pass on the knowledge.
Have a Nice Time.!!