python
config_error
ai_generated
true
django.template.exceptions.TemplateDoesNotExist: base.html
ID: python/django-template-inheritance-error
80%Fix Rate
85%Confidence
0Evidence
2025-09-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The base template file is missing or not in the template directories.
generic中文
基础模板文件缺失或不在模板目录中。
Workarounds
-
95% success
Ensure base.html exists in templates directory and set TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR/'templates']}] -
90% success
Use {% extends 'app/base.html' %} and ensure app/templates/app/base.html exists.
Dead Ends
Common approaches that don't work:
-
60% fail
Setting TEMPLATE_DIRS incorrectly doesn't find the template.
-
40% fail
Using absolute path without adding to DIRS still fails.