# Jinja2异常：模板未找到：index.html

- **ID:** `python/flask-template-not-found`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Flask无法找到指定的模板文件，因为文件在templates文件夹中缺失或文件夹路径不正确。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Ensure the template is at 'templates/index.html' relative to the Flask app root.
   ```
2. **** (70% 成功率)
   ```
   Use render_template_string with inline HTML as a temporary workaround.
   ```

## 无效尝试

- **** — Changing the template folder to an absolute path may break when the app is deployed. (60% 失败率)
- **** — Creating the template in the wrong directory (e.g., static) does not help. (80% 失败率)
