Opened 5 years ago
Closed 5 years ago
#32644 closed Bug (invalid)
TemplateDoesNotExist for templates in local apps
| Reported by: | Ronny Vedrilla | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | 3.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
Ok, I do hope this one is a valid bug ticket!
Since the update from 3.1.8 to 3.2 I get a TemplateDoesNotExist error for alle templates not living in the main template folder but within my local apps.
Project structure:
Apps live under: myproject/apps/
Main template dir: myproject/templates
Templates for an app live under: myproject/apps/myapp/templates
My config:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'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',
],
},
},
]
When I run my tests under 3.1.8, it works. When I update to 3.2 and run them, it throws the TemplateDoesNotExist exceptions.
I'd be happy to assist in any way possible.
Change History (2)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Yes, DIRS should contain full paths as documented, so in your case 'DIRS': [BASE_DIR / 'templates']. It works for me with the described project structure. Please use one of support channels if you still have an issue with templates.
I think the issue is that
DIRSisn't an absolute path. If that worked in previous versions, it was probably only by chance.