# django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured.

- **ID:** `python/django-session-serialization-error`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Accessing Django settings before django.setup() is called, often in standalone scripts.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Add `import django; django.setup()` at the beginning of the script.
   ```
2. **** (90% success)
   ```
   Use `os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')` before importing.
   ```

## Dead Ends

- **** — Breaks configuration management and may cause inconsistencies. (90% fail)
- **** — Still fails because settings are not loaded. (95% fail)
