python
config_error
ai_generated
true
jinja2.exceptions.TemplateNotFound: index.html
ID: python/flask-jinja2-template-not-found
80%Fix Rate
89%Confidence
0Evidence
2024-05-19First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2.x | active | — | — | — |
| 3.x | active | — | — | — |
Root Cause
The template file is not in the configured `templates/` folder relative to the app root, or the app was created with the wrong `root_path`.
generic中文
模板文件不在应用根目录下的 `templates/` 目录中,或应用以错误的 `root_path` 创建。
Workarounds
-
97% success
project/ app.py templates/index.html app = Flask(__name__, template_folder='templates')
-
85% success
app.jinja_loader.searchpath.append('/abs/path/templates')
Dead Ends
Common approaches that don't work:
-
70% fail
Bypasses loader but loses autoescape/extends; brittle path handling.
-
90% fail
Reload flag only affects change detection, not lookup.