A
A
Alexander2016-03-31 15:03:28
Django
Alexander, 2016-03-31 15:03:28

Is Django looking for a template in the wrong place?

Folder structure

  • lp
    • migrations
    • templates
      • landing
        • base.html


    • __init__.py
    • admin.py
    • .........


views.py:
from django.http.response import HttpResponse
from django.shortcuts import render


def index(request):
    return render(request, 'landing/base.html')

Error TemplateDoesNotExist at /
landing/base.html
In general, he looks at it in the wrong place
Using engine django:
django.template.loaders.filesystem.Loader: /home/alexander/my_projects/python_projects/landing/templates/landing/base.html (Source does not exist)
django.template.loaders.app_directories.Loader: /home/alexander/my_projects/python_projects/landing/env/lib/python3.5/site-packages/django/contrib/admin/templates/landing/base.html (Source does not exist)
django.template.loaders.app_directories.Loader: /home/alexander/my_projects/python_projects/landing/env/lib/python3.5/site-packages/django/contrib/auth/templates/landing/base.html (Source does not exist)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Melnikov, 2016-03-31
@kentuck1213

See what you have in settings.py in TEMPLATE_LOADERS and TEMPLATE_DIRS

Z
zelsky, 2016-03-31
@zelsky

Look for why he is looking in among the admin and authorization templates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question