python
config_error
ai_generated
true
jinja2.exceptions.TemplateNotFound: index.html
ID: python/flask-blueprint-template-not-found
80%Fix Rate
86%Confidence
0Evidence
2024-04-02First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Flask blueprint's template folder not set or template file not in expected directory.
generic中文
Flask 蓝图的模板文件夹未设置或模板文件不在预期目录中。
Workarounds
-
95% success
Set template_folder in Blueprint: bp = Blueprint('bp', __name__, template_folder='templates') # Ensure templates/index.html exists in blueprint package -
85% success
Use app.add_template_folder to add additional template directories
Dead Ends
Common approaches that don't work:
-
60% fail
Blueprint defaults to app's template folder unless overridden.
-
80% fail
render_template expects relative path to template folder.