# django.core.exceptions.ImproperlyConfigured: CSRF cookie not set. Request failed.

- **ID:** `python/django-missing-request-csrf-token`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The view is not using @csrf_exempt but the template lacks {% csrf_token %} in the form, causing CSRF middleware to reject the POST request.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Ensure the form in template includes {% csrf_token %} inside <form> tag.
   ```
2. **** (90% success)
   ```
   If using AJAX, include 'X-CSRFToken' header with token from cookie.
   ```

## Dead Ends

- **** — Disables security protection for all views, causing security vulnerabilities and potential 403 errors elsewhere. (95% fail)
- **** — Overrides CSRF protection globally, making the app vulnerable to CSRF attacks and breaking expected behavior. (90% fail)
