Cannot find template files for 1.11

11 views
Skip to first unread message

John Wilkinson

unread,
Apr 23, 2018, 9:18:11 AM4/23/18
to Django users
I am having trouble setting up django to find my template file I have created.

The settings.py has, among other sections, the following:


INSTALLED_APPS = [
    'designer.apps.DesignerConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]


TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ["/home/john/git/primaryWindingsCalculator/windingCalculator/designer/template"],
        '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',
            ],
        },
    },
]

If I take the entry out of the DIRS array, django won't be able to find my template file, I have put in a directory:

designer/template/designer/

I thought that if my app was in the INSTALLED_APPS list, then it would look in there dor my templates, and in 
designer/static/designer/

for all static files, that it can't find also by the way.

Any help much appreciated.

Many thanks,
John.

Matthew Pava

unread,
Apr 23, 2018, 9:22:05 AM4/23/18
to django...@googlegroups.com

DIRS does not have the path that you indicated it has.  Try changing it.

DIRS = ['designer/template/designer/']

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f86815a6-9d73-4ede-a65d-f6c62919e8eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Pava

unread,
Apr 23, 2018, 9:26:42 AM4/23/18
to django...@googlegroups.com

Actually, I just use this construct:

'DIRS': [
   
# insert your TEMPLATE_DIRS here
   
os.path.join(BASE_DIR, 'project_name', 'templates'),
],

 

 

From: django...@googlegroups.com [mailto:django...@googlegroups.com] On Behalf Of John Wilkinson
Sent: Monday, April 23, 2018 7:47 AM
To: Django users
Subject: Cannot find template files for 1.11

 

I am having trouble setting up django to find my template file I have created.

--

Reply all
Reply to author
Forward
0 new messages