Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#14342 closed Uncategorized (worksforme)

Part 2 of the Tutorial -- path format for TEMPLATE_DIR

Reported by: nwokedi Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I've tried placing the default Django admin template into a custom directory of my choice (and modifying TEMPLATE_DIR accordingly). However, Django finds the template only if the template is in a specific directory (and TEMPLATE_DIR is modified accordingly): /path/to/mysite/polls/templates/admin

Python version = 2.6
Django = latest stable release
OS = Mac OS

Change History (3)

comment:1 Changed 8 years ago by Gabriel Hurley

Component: UncategorizedDocumentation
Resolution: worksforme
Status: newclosed

Django should find the template provided the following:

  1. The template is named correctly,
  2. The template is in an admin directory
  3. The admin directory is within a directory named in your TEMPLATE_DIRS setting.

I believe the tutorial has proper instructions for accomplishing that if read carefully.

In your case, the template is being found at mysite/polls/templates/admin as you mention because the generic django.template.loaders.app_directories.load_template_source in TEMPLATE_LOADERS is finding it.

My guess is that you simply missed a detail in the tutorial or mistyped something in your paths.

If you still feel this is a problem, please give us more information about the directory you tried placing the template in, and what exactly your TEMPLATE_DIRS looked like?

comment:2 Changed 6 years ago by sheridb3@…

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

Hi there

I am having a similar problem. I have the following absolute path in the TEMPLATE_DIRS in C:/Users/BernardWork/Documents/Work/WebStuff/mysite/admin/base_site.html

with base_site.html containing the edited admin name but the django.template.loaders.filesystem.Loader seems to be ignoring this path and using the location of the django source could base_site.html page. But when put inside my project mysite/polls/templates/admin it works and I know this is using the django.template.loaders.app_directories.load_template_source but it works while the other doesnt and I followed all instructions to the T. If you could get back to me on where I am going wrong I would really appreciate it. I am using a Windows 7 32- bit system and django 1.4.2 and python 2.7.

Many Thanks


comment:3 Changed 6 years ago by Tim Graham

TEMPLATE_DIRS should be a list of directories, not files. So you would want 'C:/Users/BernardWork/Documents/Work/WebStuff/mysite/admin/' in your TEAMPLATE_DIRS. But, please don't use the ticket system for support issues. Please see

Note: See TracTickets for help on using tickets.
Back to Top