# django.db.utils.OperationalError: database is locked

- **ID:** `python/django-database-lock-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

数据库文件被其他进程锁定，通常发生在 SQLite

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.2 | active | — | — |
| 4.0 | active | — | — |

## Workarounds

1. **等待锁释放** (80% success)
   ```
   等待其他操作完成，或重启应用
   ```
2. **切换到 PostgreSQL 或 MySQL** (95% success)
   ```
   修改 DATABASES 配置使用其他数据库后端
   ```

## Dead Ends

- **杀死所有数据库进程** — 可能导致数据损坏 (70% fail)
- **使用内存数据库** — 数据不持久化 (90% fail)
