# werkzeug.exceptions.MethodNotAllowed: 405 Method Not Allowed: The method is not allowed for the requested URL

- **ID:** `python/flask-method-not-allowed`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The HTTP method used in the request is not allowed for the route (e.g., POST on a GET-only route).

## Version Compatibility

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

## Workarounds

1. **Add the correct method to the route decorator** (95% success)
   ```
   @app.route('/login', methods=['GET', 'POST'])
def login():
    return "Login page"
   ```
2. **Use the correct HTTP method in the request** (90% success)
   ```
   curl -X POST http://localhost:5000/login
   ```

## Dead Ends

- **Changing the request method without checking the route** — May cause other errors if the route expects specific methods. (60% fail)
- **Adding a catch-all route without methods** — Can override intended behavior and cause security issues. (75% fail)
