I am using docker and the debug toolbar gives the following error:
BaseConnectionHandler.all() got an unexpected keyword argument 'initialized_only'
I wrote the following code in the settings.py file :
if DEBUG:
MIDDLEWARE = [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
INSTALLED_APPS = [
'debug_toolbar',
]
import os
import socket
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS = [ip[: ip.rfind(".")] ".1" for ip in ips] ["127.0.0.1", "10.0.2.2"]
I wrote the following code in the urls.py file :
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
]
CodePudding user response:
For some reason django-debug-toolbar==3.5.0
broke backward compatability with Django lower than 4.1b1.
In 3.5.0 next changes were added: https://github.com/jazzband/django-debug-toolbar/commit/4b77ec74f2d326013d715453d7a2219e574c3f6a#diff-72ecd973e54107d746eff0947206cbdbe24cbb3c42216b00615e64d49ca70d73R216-R217
But those changes need this changes in Django 4.1b1 to work: https://github.com/django/django/commit/4f92cf87b013801810226928ddd20097f6e4fccf#diff-dbe1d4538efcca9f9a6157d5d3de919e0844835a7ccc698bb8c5d4a9eb06e274R75-R81
Fix the version of django-debug-toolbar to 3.4.0 before issue is solved. Opened issue in github: https://github.com/jazzband/django-debug-toolbar/issues/1645
UPD: Django 3.2.4 will also work and thats probably better solution.