Thanks a lot!!!
My apologies, It is just because it is the first time for me in this Google forum, so I didn't replay asap.
My apologies again for not being clear enough!
So the fact that I got that error was just because the template folder was outside my main project and that the endless hierarchy of folders and files in a single Django project can be real pain. That is one reason, another one is that because of VS Code not having a clearer view of the files view browser. This is what confused me!
On Friday, March 5, 2021 at 11:15:03 PM UTC+3 gabriela...@gmail.com wrote:
Kasper is right, we need more clear.But anyway, here is one example. In settings.py:from pathlib import Path
import osROOT_URLCONF = 'sclub.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['sclub/appsclub/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',
],
},
},
]sclub is my project and appsclub is my AppGabriel Araya GarciaGMI - Desarrollo de Sistemas InformáticosEl vie, 5 mar 2021 a las 11:16, NB DEV (<nbl....@gmail.com>) escribió:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 3.1.7
Python Version: 3.9.1
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'pages.apps.PagesConfig']
Installed 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']
Template loader postmortem
Django tried loading these templates, in this order:
Using engine django:
* django.template.loaders.filesystem.Loader: C:\Users\napil\Desktop\dev\btre_project\templates\pages\index.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\contrib\admin\templates\pages\index.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\contrib\auth\templates\pages\index.html (Source does not exist)
Traceback (most recent call last):
File "C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\napil\Desktop\dev\btre_project\pages\views.py", line 6, in index
return render(request, 'pages/index.html')
File "C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\template\loader.py", line 61, in render_to_string
template = get_template(template_name, using=using)
File "C:\Users\napil\Desktop\dev\btre_project\venv\lib\site-packages\django\template\loader.py", line 19, in get_template
raise TemplateDoesNotExist(template_name, chain=chain)
Exception Type: TemplateDoesNotExist at /
Exception Value: pages/index.html
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f6202d4-5ab8-4c58-a7c6-1d55a9d2fb7an%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fdc36347-a230-448a-978c-29c91f8f437an%40googlegroups.com.
No comments:
Post a Comment