1

According to Django documentation

"Your project’s TEMPLATES setting describes how Django will load and render templates. The default settings file configures a DjangoTemplates backend whose APP_DIRS option is set to True. By convention DjangoTemplates looks for a “templates” subdirectory in each of the INSTALLED_APPS."

My Mezzanine settings.py has this configuration

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [],
    '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',
        ],
    },
},

]

My directory structure is

project
    app_name
        templates
            app_name
                index.html

But the template loader stops at

project
    app_name
        templates

As such my app_name template index.html is not reached. What can be the problem?

JTheboss
  • 57
  • 2
  • 11

2 Answers2

0

Then you could reach your template with 'app_name/index.html'

brunoelottero
  • 80
  • 1
  • 7
0

Did you try to change your template dirs on setting.py like this

'DIRS': ["templates"],

and did your views.py provide specific location of template E.g.

return render(request, 'foldername/templatename.html', {})
f_h
  • 36
  • 1
  • 6
  • Any way to make Django recurse to the directories beyond the 'templates' directory? – JTheboss Sep 29 '16 at 20:24
  • Read this [site](http://stackoverflow.com/questions/1740436/what-is-the-best-location-to-put-templates-in-django-project) maybe will help to answer your question, but creating a `templates` directory inside your app directory is ideal to store your app-specific templates. – f_h Sep 30 '16 at 00:38