#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 |
Description
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 by , 14 years ago
Component: | Uncategorized → Documentation |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
comment:2 by , 12 years ago
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 settings.py: 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
Bernard
comment:3 by , 12 years ago
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 https://docs.djangoproject.com/en/dev/#getting-help
Django should find the template provided the following:
admin
directoryadmin
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 genericdjango.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?