python
config_error
ai_generated
true
django.core.exceptions.ImproperlyConfigured: 'default' database isn't configured.
ID: python/django-multiple-db-router-error
80%Fix Rate
86%Confidence
0Evidence
2024-08-21First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
DATABASES设置中缺少default键
generic中文
settings.py中DATABASES字典没有default配置项
Workarounds
-
95% success
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3'}} -
85% success
配置路由器类以处理数据库选择
Dead Ends
Common approaches that don't work:
-
80% fail
Django默认使用default,除非显式指定
-
90% fail
所有数据库操作都会失败