Найти - Пользователи
Полная версия: Не видит путь с шаблонами
Начало » Django » Не видит путь с шаблонами
1
dezinfo
Ошибка поиска шаблона.

Template-loader postmortem

Django tried loading these templates, in this order:
•Using loader django.template.loaders.filesystem.Loader:
•Using loader django.template.loaders.app_directories.Loader: ◦C:\Python34\lib\site-packages\django\contrib\admin\templates\hello.html (File does not exist)
◦C:\Python34\lib\site-packages\django\contrib\auth\templates\hello.html (File does not exist)

Судя по ошибке в упор не хочет искать шаблоны по прописанному в settings.py пути


TEMPLATE_DIRS = ()
for root, dirs, files in os.walk(BASE_DIR):
if ‘templates’ in dirs: TEMPLATE_DIRS += (os.path.join(root, ‘templates’),)

В чем может быть проблема

JOHN_16
Для начала проверить содержимое TEMPLATE_DIRS - потому что вывод
dezinfo
◦C:\Python34\lib\site-packages\django\contrib\admin\templates\hello.html (File does not exist)
◦C:\Python34\lib\site-packages\django\contrib\auth\templates\hello.html (File does not exist)
говорит вам что путей то он действительно не имеет.

И да, версию джанги огласите, а то синтаксис для старых версий, в 1.8 и м.б. 1.7 такое не сработает.
dezinfo
Django Version: 1.8

Лог Settings в аттаче

Если кинуть файл hello.html в одну из данных папок работает отлично
◦C:\Python34\lib\site-packages\django\contrib\admin\templates\hello.html (File does not exist)
◦C:\Python34\lib\site-packages\django\contrib\auth\templates\hello.html (File does not exist)
JOHN_16
dezinfo
ну так посмотрите на документацию Джанги 1.8 и увидите что там по другому нужно указывать TEMPLATES
dezinfo
JOHN_16
ну так посмотрите на документацию Джанги 1.8 и увидите что там по другому нужно указывать TEMPLATES

Thank you. The problem solved.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB