﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25964	AttributeError: 'HttpResponse' object has no attribute '_reason_phrase'	George Karakostas	nobody	"When using Django 1.9 with wsgi, the following error occurs:

{{{
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] mod_wsgi (pid=31977): Exception occurred processing WSGI script '/var/www/vhosts/.../index.wsgi'. 
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] Traceback (most recent call last): 
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] File ""/var/virtualenvs/ttours/lib/python3.4/site-packages/django/core/handlers/wsgi.py"", line 181, in __call__ 
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] status = '%s %s' % (response.status_code, response.reason_phrase) 
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] File ""/var/virtualenvs/ttours/lib/python3.4/site-packages/django/http/response.py"", line 63, in reason_phrase 
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] if self._reason_phrase is not None: 
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] AttributeError: 'HttpResponse' object has no attribute '_reason_phrase' 
}}}

It appears that this has something to do with this recent change, as indicated in 1.9 release notes:

    django.http.responses.REASON_PHRASES and django.core.handlers.wsgi.STATUS_CODE_TEXT have been removed. Use Python’s stdlib instead: http.client.responses for Python 3 and httplib.responses for Python 2.

But in django/core/handlers/wsgi.py https://github.com/django/django/blob/stable/1.9.x/django/core/handlers/wsgi.py#L181 it clearly uses it:

{{{
status = '%s %s' % (response.status_code, response.reason_phrase)
}}}

This prevents Django 1.9 to be deployed in wsgi."	Bug	closed	Core (Other)	1.9	Normal	invalid			Unreviewed	0	0	0	0	0	0
