Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
Django 3.0.5 with mod_wsgi: AttributeError: 'HttpResponse' object has no attribute '_resource_closers'

I'm getting an error when I deploy Django 3.0.5 under mod_wsgi: AttributeError: 'HttpResponse' object has no attribute '_resource_closers'. I'm running:

  • Python: 3.6.8
  • Django: 3.0.5
  • Apache: 2.4.6
  • mod_wsgi: 4.6.2

Here's the basics of the view causing the error; nothing too exotic (I've simplified the code around meetings_struct):

class MeetingsAPIView(MeetingsBaseView):
    def get(self, request, *args, **kwargs):
        meetings = self.get_meetings()
        meetings_struct = []

        for meeting in meetings:
            meetings_struct.append({
                "id": meeting.id,
                "name": meeting.title,
                "slug": meeting.slug,
            })

        return HttpResponse(meetings_struct, content_type="application/json")

If I activate the venv and use runserver manually on the server on port 80, the same view does not give an error. When the same code and venv are running under Apache, here's the error from Apache's logs:

[Sat Apr 18 16:11:30.683980 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397] mod_wsgi (pid=4154): Exception occurred processing WSGI script '/var/django/sites/mysite-prod/config/wsgi.py'.
[Sat Apr 18 16:11:30.684834 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397] Traceback (most recent call last):
[Sat Apr 18 16:11:30.684891 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397]   File "/var/django/sites/mysite-prod/venv/lib64/python3.6/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
[Sat Apr 18 16:11:30.684903 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397]     response = self.get_response(request)
[Sat Apr 18 16:11:30.684925 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397]   File "/var/django/sites/mysite-prod/venv/lib64/python3.6/site-packages/django/core/handlers/base.py", line 76, in get_response
[Sat Apr 18 16:11:30.684933 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397]     response._resource_closers.append(request.close)
[Sat Apr 18 16:11:30.684964 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397] AttributeError: 'HttpResponse' object has no attribute '_resource_closers'

I've rolled back to a previous version that works, running Django 2.2; the rest of the stack is the same. This one has me puzzled, as using the same deployed code with the same venv that Apache is configured to use works fine under runserver, but errors with mod_wsgi.

I've tried stopping and starting Apache, running the publish process again for a fresh venv and code base, and even rebooting the server. The same error occurs, but only under Apache / mod_wsgi.

Any ideas? I'm puzzled!

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda