Jonathan
Jonathan

Reputation: 219

Django telling me the template doesn't exist

For some reason, Django is telling me the template I'm trying to load doesn't exist. When I look at the path, it appears that the first template its trying to load actually repeats the path twice one after the other. My template dirs only lists the following path once:

'/Users/jonathanschen/python/projects/skeleton/yectime/templates'

But the loader tries to load

'/Users/jonathanschen/python/projects/skeleton/yectime/Users/jonathanschen/Python/projects/skeleton/yectime/templates/base.html'

Any ideas what could be causing this? Thanks in advance.

Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/jonathanschen/python/projects/skeleton/yectime/Users/jonathanschen/Python/projects/skeleton/yectime/templates/base.html (File does not exist)

Upvotes: 1

Views: 4740

Answers (1)

supervacuo
supervacuo

Reputation: 9262

It looks like you have:

TEMPLATE_DIRS = ('Users/jonathanschen/Python/projects/skeleton/yectime/templates',)

where you should have:

TEMPLATE_DIRS = ('/Users/jonathanschen/Python/projects/skeleton/yectime/templates',)

(note the leading slash, "/").

A path that doesn't start with a slash is a "relative" path; it's added to the path of the current directory. Given your manage.py is probably in /Users/jonathanschen/Python/projects/skeleton/, the path Django is trying to look in for templates would end up being the long, wrong path you posted above.

Upvotes: 2

Related Questions