On Saturday, May 16, 2020 at 5:02:32 PM UTC-4, jlgimeno71 wrote:
On Sat, May 16, 2020 at 12:06 PM Tim Allen <fli...@peregrinesalon.com> wrote:I posted this to Stack Overflow first, thinking it might be a problem with `mod_wsgi`, but people using Gunicorn have seen the issue too. Here's a link to the question on Stack Overflow:--https://stackoverflow.com/questions/61295971/django-3-0- 5-with-mod-wsgi- attributeerror-httpresponse- object-has-no-attribu Unfortunately, purging my cache hasn't fixed the problem like it did for a commenter on the question, so I'm asking here for amplification. Here's the text of the post:I'm getting an error when I deploy Django 3.0.5 undermod_wsgi
:AttributeErro
. I'm running:r: 'HttpResponse' object has no attribute '_resource_closers'
- 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(MeetingsBaseVi
ew ): 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 userunserver
manually on the server on port 80, the same view does not give an error. When the same code andvenv
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/ , 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-site-packages/django/core/ handlers/wsgi.py" prod/venv/lib64/python3.6/ , 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.appsite-packages/django/core/ handlers/base.py" end (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 underrunserver
, but errors withmod_wsgi
. I've tried stopping and starting Apache, running the publish process again for a freshvenv
and code base, and even rebooting the server. The same error occurs, but only under Apache / mod_wsgi.
Any ideas? I'm puzzled!
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0381e998- .321e-489f-abe1-853b6997930f% 40googlegroups.com Tim,Shot in the dark: Did you add any middleware by chance?-Jorge
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f80c3888-eaac-48da-adaf-1862e1d4be5f%40googlegroups.com.
No comments:
Post a Comment