缓存面板不处理模块级上导入的"缓存"
作者: blueyed创建于 2016年1月11日更新于 2026年8月8日
标签Bug
在模块中使用 `from django.core.cache import caches` 时,该模块只在处理视图之前加载,此时 `caches.caches` 实例不会通过 `CacheHandlerPatch` 进行修改。一种可能的解决方案是不要在此使用 `enable_instrumentation` / `disable_instrumentation`,而是在导入时在 `debug_toolbar.panels.cache` 中执行此操作。
内容来源: django-commons/django-debug-toolbar