# ImportError: cannot import name 'current_app' from 'flask'

- **ID:** `python/flask-importerror-cannot-import-name-current-app`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to import current_app from flask, but it's not a top-level import; it's part of flask.globals.

## Version Compatibility

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

## Workarounds

1. **Import current_app from flask.globals.** (90% success)
   ```
   from flask.globals import current_app
   ```
2. **Use app.app_context() to access current_app.** (85% success)
   ```
   with app.app_context():
    from flask import current_app
    # use current_app
   ```

## Dead Ends

- **Using 'from flask import current_app' incorrectly in a script.** — current_app is available only within a request context; importing it outside causes ImportError. (70% fail)
- **Typo: using 'currentapp' instead of 'current_app'.** — The exact name is 'current_app'; any typo leads to ImportError. (80% fail)
