Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jul 2024 08:22:09 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 280254] net-mgmt/netbox: ImportError: cannot import name '_HTML_TYPES' from 'debug_toolbar.middleware'
Message-ID:  <bug-280254-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D280254

            Bug ID: 280254
           Summary: net-mgmt/netbox: ImportError: cannot import name
                    '_HTML_TYPES' from 'debug_toolbar.middleware'
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: kai@FreeBSD.org
          Reporter: freebsd@wb9.se
          Assignee: kai@FreeBSD.org
             Flags: maintainer-feedback?(kai@FreeBSD.org)

After upgrading netbox today I got this message when running the migration
post-installation step:

WARNINGS:
?: (debug_toolbar.W001) debug_toolbar.middleware.DebugToolbarMiddleware is
missing from MIDDLEWARE.
        HINT: Add debug_toolbar.middleware.DebugToolbarMiddleware to
MIDDLEWARE.

I followed the instructions and updated MIDDLEWARE netbox/settings.py which
made the warning disappear. When trying to restart netbox afterwards it cra=
shed
and I found the following message in the logs:

gunicorn.netbox.error: [7635] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line =
609,
in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/gthread.py=
",
line 95, in init_process
    super().init_process()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", =
line
134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", =
line
146, in load_wsgi
    self.wsgi =3D self.app.wsgi()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line=
 67,
in wsgi
    self.callable =3D self.load()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", l=
ine
58, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", l=
ine
48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 371=
, in
import_app
    mod =3D importlib.import_module(module)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlock=
ed
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_remo=
ved
  File "/usr/local/share/netbox/netbox/wsgi.py", line 7, in <module>
    application =3D get_wsgi_application()
  File "/usr/local/lib/python3.10/site-packages/django/core/wsgi.py", line =
13,
in get_wsgi_application
    return WSGIHandler()=20
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/wsgi.p=
y",
line 118, in __init__
    self.load_middleware()
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.p=
y",
line 40, in load_middleware
    middleware =3D import_string(middleware_path)
  File
"/usr/local/lib/python3.10/site-packages/django/utils/module_loading.py", l=
ine
30, in import_string
    return cached_import(module_path, class_name)
  File
"/usr/local/lib/python3.10/site-packages/django/utils/module_loading.py", l=
ine
15, in cached_import
    module =3D import_module(module_path)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlock=
ed
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_remo=
ved
  File
"/usr/local/lib/python3.10/site-packages/graphiql_debug_toolbar/middleware.=
py",
line 7, in <module>
    from debug_toolbar.middleware import _HTML_TYPES#012ImportError: cannot
import name '_HTML_TYPES' from 'debug_toolbar.middleware'
(/usr/local/lib/python3.10/site-packages/debug_toolbar/middleware.

Reading some code I found that the _HTML_TYPES is set in debug_toolbar.utils
and not debug_toolbar.middleware. After monkey-patching
/usr/local/lib/python3.10/site-packages/graphiql_debug_toolbar/middleware.p=
y to
import from debug_toolbar.utils instead netbox starts again. I'm guessing t=
his
is a dependency-version-incompatibility-thing?

relevant installed packages:
netbox-3.7.8_3
py310-django-debug-toolbar-4.4.6
py310-django-graphiql-debug-toolbar-0.2.0_3

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-280254-7788>