{
  "id": "python/pytest-django-settings-not-configured",
  "signature": "pytest.PytestConfigWarning: Unknown config option: DJANGO_SETTINGS_MODULE\nE   django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured.",
  "signature_zh": "pytest.PytestConfigWarning: 未知配置项: DJANGO_SETTINGS_MODULE\nE   django.core.exceptions.ImproperlyConfigured: 请求设置 INSTALLED_APPS，但设置未配置。",
  "regex": "pytest\\.PytestConfigWarning:\\ Unknown\\ config\\ option:\\ DJANGO_SETTINGS_MODULE\\\nE\\ \\ \\ django\\.core\\.exceptions\\.ImproperlyConfigured:\\ Requested\\ setting\\ INSTALLED_APPS,\\ but\\ settings\\ are\\ not\\ configured\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "pytest-django is not installed or not active, so DJANGO_SETTINGS_MODULE in pytest.ini is ignored and Django isn't configured before import.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest-django 未安装或未启用，导致 pytest.ini 中的 DJANGO_SETTINGS_MODULE 被忽略，Django 在导入前未配置。",
  "versions": [
    {
      "version": "4.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Works only if `django.setup()` is also called; still fails on fixtures.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "pytest-django does this itself; double-init causes warnings and test DB issues.",
      "fail_rate": 0.55,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "pip install pytest-django, then in pyproject.toml:\n[tool.pytest.ini_options]\nDJANGO_SETTINGS_MODULE = \"myproj.settings\"\npython_files = \"tests.py test_*.py *_tests.py\"",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}