# jinja2.exceptions.TemplateNotFound: index.html

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

## Root Cause

Jinja2Templates directory does not contain the template, or the directory path is wrong relative to the working directory.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (93% success)
   ```
   templates = Jinja2Templates(directory=Path(__file__).parent / 'templates')
   ```
2. **** (85% success)
   ```
   Verify file exists: print(list((Path(__file__).parent/'templates').iterdir()))
   ```

## Dead Ends

- **** — Trailing slash can cause double-slash path issues in some versions. (40% fail)
- **** — Breaks deployment layout and packaging. (60% fail)
