[Bug 280254] net-mgmt/netbox: ImportError: cannot import name '_HTML_TYPES' from 'debug_toolbar.middleware'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 13 Jul 2024 08:22:09 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280254 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 crashed 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 = self.app.wsgi() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 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 = 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_unlocked 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_removed File "/usr/local/share/netbox/netbox/wsgi.py", line 7, in <module> application = get_wsgi_application() File "/usr/local/lib/python3.10/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application return WSGIHandler() File "/usr/local/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 118, in __init__ self.load_middleware() File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 40, in load_middleware middleware = import_string(middleware_path) File "/usr/local/lib/python3.10/site-packages/django/utils/module_loading.py", line 30, in import_string return cached_import(module_path, class_name) File "/usr/local/lib/python3.10/site-packages/django/utils/module_loading.py", line 15, in cached_import module = 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_unlocked 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_removed 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.py to import from debug_toolbar.utils instead netbox starts again. I'm guessing this 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 -- You are receiving this mail because: You are the assignee for the bug.