Django Template Loader not reaching app template

Question!

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?

By : JTheboss


Answers

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', {})
By : f_h


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



If I am reading this correctly, Message would contain a List<MessageUser>.

If that's the case then this should get you close:

var List<Message> messages = 
    ( from m 
      in db.Messages 
      where 
          m.UserID == userid || m.MessageUsers.Any(mu => mu.UserID == userID) 
      select m).ToList();
By : Sam Axe


This video can help you solving your question :)
By: admin