[Answer]-Server doesn't follow TEMPLATE_DIRS path

1đź‘Ť

First things first: static and templates are two very separate “things” and should not have anything in common – meaning that “templates” directory should be next to “static”, not inside it.

There are by default two location where Django looks for template files:

  • directory / directories specified in TEMPLATE_DIRS
  • templates directory in each installed app (app that is in INSTALLED_APPS)

Your settings seem valid for the first case, so it’s probably some simple error:

  • Is TEMPLATE_DIRS still a tuple? TEMPLATE_DIRS =( os.path.blah.blah, ), the comma is necessary
  • I don’t see an exact mechanism that will cause problems when your templates directory is inside your static directory, but you should definitely move it out of there.
  • Make sure the TEMPLATE_LOADERS setting its default value
👤frnhr

0đź‘Ť

The static url should point to the staticfiles directory. And why do you put templates under staticfiles? You may have it as a seperate folder in the main folder(along with manage.py)

Leave a comment