# jinja2.exceptions.TemplateNotFound: index.html

- **ID:** `python/flask-template-not-found-error`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Flask 在默认模板目录 'templates' 中找不到指定的模板文件

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **创建 templates 文件夹并放置模板文件** (95% success)
   ```
   mkdir templates && mv index.html templates/
   ```
2. **在 Flask 应用中自定义模板目录** (90% success)
   ```
   app = Flask(__name__, template_folder='custom_templates')
   ```

## Dead Ends

- **将模板文件放在项目根目录而非 templates 文件夹** — Flask 默认只搜索 templates 文件夹 (80% fail)
- **修改模板路径为绝对路径但忘记更新 render_template 调用** — 路径不匹配或权限问题 (60% fail)
