Skip to content

Django product announcement error on startup #14041

@P-T-I

Description

@P-T-I

Bug description
Getting the following error when deploying:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/django/contrib/messages/api.py", line 27, in add_message
    messages = request._messages
               ^^^^^^^^^^^^^^^^^
AttributeError: 'WSGIRequest' object has no attribute '_messages'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.13/site-packages/django/utils/deprecation.py", line 120, in __call__
    response = response or self.get_response(request)
                           ~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/django/core/handlers/exception.py", line 57, in inner
    response = response_for_exception(request, exc)
  File "/usr/local/lib/python3.13/site-packages/django/core/handlers/exception.py", line 141, in response_for_exception
    response = handle_uncaught_exception(
        request, get_resolver(get_urlconf()), sys.exc_info()
    )
  File "/usr/local/lib/python3.13/site-packages/django/core/handlers/exception.py", line 186, in handle_uncaught_exception
    return callback(request)
  File "/app/dojo/views.py", line 61, in custom_error_view
    ErrorPageProductAnnouncement(request=request)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/app/dojo/product_announcements.py", line 80, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        *args,
        ^^^^^^
    ...<3 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/app/dojo/product_announcements.py", line 33, in __init__
    self._add_django_message(
    ~~~~~~~~~~~~~~~~~~~~~~~~^
        request=request,
        ^^^^^^^^^^^^^^^^
        message=mark_safe(f"{self.base_message} {self.ui_outreach}"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/dojo/product_announcements.py", line 51, in _add_django_message
    messages.add_message(
    ~~~~~~~~~~~~~~~~~~~~^
        request=request,
        ^^^^^^^^^^^^^^^^
    ...<2 lines>...
        extra_tags="alert-info",
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/django/contrib/messages/api.py", line 35, in add_message
    raise MessageFailure(
    ...<2 lines>...
    )
django.contrib.messages.api.MessageFailure: You cannot add messages without installing django.contrib.messages.middleware.MessageMiddleware

Steps to reproduce
Helm chart install executed;

Expected behavior
Normal startup with no errors

Deployment method (select with an X)

  • Docker Compose
  • Kubernetes
  • GoDojo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions