Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Django 3.0.5 con mod_wsgi: AttributeError: el objeto 'HttpResponse' no tiene atributo '_resource_closers'

Recibo un error cuando implemento Django 3.0.5 en mod_wsgi : AttributeError: 'HttpResponse' object has no attribute '_resource_closers' . Estoy corriendo:

  • Pitón: 3.6.8
  • Django: 3.0.5
  • Apache: 2.4.6
  • mod_wsgi: 4.6.2

Estos son los conceptos básicos de la vista que causa el error; nada demasiado exótico (he simplificado el código en torno a 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")

Si activo el venv y uso runserver manualmente en el servidor en el puerto 80, la misma vista no da error. Cuando el mismo código y venv se ejecutan en Apache, este es el error de los registros de Apache:

 [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'

Regresé a una versión anterior que funciona, ejecutando Django 2.2; el resto de la pila es la misma. Este me tiene desconcertado, ya que usar el mismo código implementado con el mismo venv que Apache está configurado para usar funciona bien en runserver , pero los errores con mod_wsgi .

Intenté detener e iniciar Apache, ejecutar el proceso de publicación nuevamente para obtener una nueva base de código y venv , e incluso reiniciar el servidor. Ocurre el mismo error, pero solo bajo Apache / mod_wsgi.

¿Algunas ideas? ¡Estoy confundido!

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!