NoReverseMatch exception when accessing the background tasks admin view with django-rq 2.3.0 installed #3545

Closed
opened 2025-12-29 18:29:48 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Apr 6, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.7.11 (w/django-rq 2.3.0)

NOTE: This does not affect the standard installation. This bug is only triggered with django_rq 2.3.0 or later.

Steps to Reproduce

  1. pip install django_rq==2.3.0
  2. Navigate to admin > Utilities > Background Tasks

Expected Behavior

The view should render

Observed Behavior

An exception is raised:

Traceback:

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django_rq/views.py" in stats
  31.         **admin.site.each_context(request),

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/admin/sites.py" in each_context
  302.             'available_apps': self.get_app_list(request),

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/admin/sites.py" in get_app_list
  474.         app_dict = self._build_app_dict(request)

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/admin/sites.py" in _build_app_dict
  459.                         current_app=self.name,

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/urls/base.py" in reverse
  90.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))

File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/urls/resolvers.py" in _reverse_with_prefix
  673.         raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /admin/background-tasks/
Exception Value: Reverse for 'app_list' with keyword arguments '{'app_label': 'taggit'}' not found. 1 pattern(s) tried: ['admin\\/(?P<app_label>auth|extras|secrets|users)/$']

django_rq was changed in v2.3.0 to render admin UI templates with context. However, it is using the default Django admin site rather than NetBox's custom admin site, which appears to be leading to the error.

Originally created by @jeremystretch on GitHub (Apr 6, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.7.11 (w/django-rq 2.3.0) **NOTE:** This does **not** affect the standard installation. This bug is only triggered with `django_rq` 2.3.0 or later. ### Steps to Reproduce 1. `pip install django_rq==2.3.0` 2. Navigate to admin > Utilities > Background Tasks ### Expected Behavior The view should render ### Observed Behavior An exception is raised: ``` Traceback: File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request) File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 21. return view_func(request, *args, **kwargs) File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django_rq/views.py" in stats 31. **admin.site.each_context(request), File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/admin/sites.py" in each_context 302. 'available_apps': self.get_app_list(request), File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/admin/sites.py" in get_app_list 474. app_dict = self._build_app_dict(request) File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/contrib/admin/sites.py" in _build_app_dict 459. current_app=self.name, File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/urls/base.py" in reverse 90. return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)) File "/home/jstretch/.virtualenvs/netbox/lib/python3.6/site-packages/django/urls/resolvers.py" in _reverse_with_prefix 673. raise NoReverseMatch(msg) Exception Type: NoReverseMatch at /admin/background-tasks/ Exception Value: Reverse for 'app_list' with keyword arguments '{'app_label': 'taggit'}' not found. 1 pattern(s) tried: ['admin\\/(?P<app_label>auth|extras|secrets|users)/$'] ``` django_rq was [changed](https://github.com/rq/django-rq/commit/9c89f890b756aef2d94fe6b113629a84d5ccc997) in v2.3.0 to render admin UI templates with context. However, it is using the default Django admin site rather than NetBox's custom admin site, which appears to be leading to the error.
adam added the type: bugstatus: accepted labels 2025-12-29 18:29:48 +01:00
adam closed this issue 2025-12-29 18:29:48 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3545