python config_error ai_generated true

django.template.exceptions.TemplateDoesNotExist: base.html

ID: python/django-template-inheritance-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2025-09-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

The base template file is missing or not in the template directories.

generic

中文

基础模板文件缺失或不在模板目录中。

Workarounds

  1. 95% success
    Ensure base.html exists in templates directory and set TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR/'templates']}]
  2. 90% success
    Use {% extends 'app/base.html' %} and ensure app/templates/app/base.html exists.

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Setting TEMPLATE_DIRS incorrectly doesn't find the template.

  2. 40% fail

    Using absolute path without adding to DIRS still fails.