django-debug-toolbar: After upgrading to Django 4.2 LTS, I receive AttributeError on each page load. Using DDT 4.0.0
E0506 14:25:32.246 django.request:241 Internal Server Error: /dashboard/
Traceback (most recent call last):
File "C:\Users\Owner\.virtualenvs\premind-6P0nJig8\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\Owner\.virtualenvs\premind-6P0nJig8\lib\site-packages\sentry_sdk\integrations\django\middleware.py", line 176, in __call__
return f(*args, **kwargs)
File "C:\Users\Owner\.virtualenvs\premind-6P0nJig8\lib\site-packages\debug_toolbar\middleware.py", line 64, in __call__
panel.disable_instrumentation()
File "C:\Users\Owner\.virtualenvs\premind-6P0nJig8\lib\site-packages\debug_toolbar\panels\cache.py", line 217, in disable_instrumentation
self._unmonkey_patch_cache(cache)
File "C:\Users\Owner\.virtualenvs\premind-6P0nJig8\lib\site-packages\debug_toolbar\panels\cache.py", line 171, in _unmonkey_patch_cache
if original_method.__func__ == getattr(cache.__class__, name):
AttributeError: 'function' object has no attribute '__func__'
Commenting debug_toolbar.panels.cache.CachePanel
allows DDT to continue to work.
# settings.py
MIDDLEWARE = [
"django.middleware.gzip.GZipMiddleware",
]
if DEBUG_TOOLBAR:
INSTALLED_APPS += ["debug_toolbar"]
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
DEBUG_TOOLBAR_PANELS = [
"debug_toolbar.panels.history.HistoryPanel",
"debug_toolbar.panels.versions.VersionsPanel",
"debug_toolbar.panels.timer.TimerPanel",
"debug_toolbar.panels.settings.SettingsPanel",
"debug_toolbar.panels.headers.HeadersPanel",
"debug_toolbar.panels.request.RequestPanel",
"debug_toolbar.panels.sql.SQLPanel",
# 'debug_toolbar.panels.staticfiles.StaticFilesPanel', # breaks if minio is enabled
"debug_toolbar.panels.templates.TemplatesPanel",
# "debug_toolbar.panels.cache.CachePanel", # commenting this line allows DDT to continue to work
"debug_toolbar.panels.signals.SignalsPanel",
"debug_toolbar.panels.logging.LoggingPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
"debug_toolbar.panels.profiling.ProfilingPanel",
]
Please let me know if you need any more information in order to solve this issue
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 23 (16 by maintainers)
I’m also seeing this after upgrading from django 4.1 to 4.2:
I see sentry in the stacktrace there. AFAIK, sentry does some money-patching too, so there might be a conflict there.
My
settings.py
includes:If I comment out this block, my site works again. It seems that the conflict arises when debug toolbar AND sentry are both present.