V
V
Vitaly Ananiev2021-12-22 00:03:34
Django
Vitaly Ananiev, 2021-12-22 00:03:34

Why is ListView not working?

All paths configured TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(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 ',
],
},
},
]

The templates folder with the html file has been created, but for some reason, when the runserver starts, it says:
Internal Server Error: /
Traceback (most recent call last):
File "C:\Users\Vitaliy\PycharmProjects\Funpay\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\Vitaliy\PycharmProjects\Funpay\venv\lib\site-packages\django\core\handlers\base.py", line 204, in _get_response
response = response.render()
File "C:\Users\Vitaliy\PycharmProjects\Funpay\venv\lib\site-packages\django\template\response.py", line 105, in render
self.content = self.rendered_content
File "C:\Users\Vitaliy \PycharmProjects\Funpay\venv\lib\site-packages\django\template\response.py", line 81, in rendered_content
template = self.resolve_template(self.template_name)
File "C:\Users\Vitaliy\PycharmProjects\Funpay\venv\lib\site-packages\django\template\response.py", line 63, in resolve_template
return select_template(template, using=self.using)
File "C:\Users\Vitaliy\PycharmProjects\Funpay\venv\lib\site-packages\django\template\loader.py", line 47, in select_template
raise TemplateDoesNotExist(', '.join( template_name_list), chain=chain)
django.template.exceptions.TemplateDoesNotExist: Pay/games_list.html
[21/Dec/2021 22:57:50] "GET / HTTP/1.1" 500 77720

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leonid, 2021-12-22
@bravebug

I'm almost completely zero in django, but judging by the tracebacks, django does not find the document template at:
Pay/games_list.html
, the paths / path or something with the directory structure may not be correctly specified / not specified.
Maybe you created a directory with templates in the project folder, and not the application?
Here it was about the directory structure:
https://docs.djangoproject.com/en/3.2/intro/tutori...

V
Vladislava, 2021-12-28
@vladis005

Check whether everything is written correctly in terms of spelling. Perhaps you described yourself somewhere when you specified games_list.html.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question