Skip to content

Instantly share code, notes, and snippets.

@mickeypash
Created August 20, 2015 12:15
Show Gist options
  • Save mickeypash/12090e950d1d1611860b to your computer and use it in GitHub Desktop.
Save mickeypash/12090e950d1d1611860b to your computer and use it in GitHub Desktop.
This problem occurs when participants attempt to view a document.
Environment:
Request Method: GET
Request URL: http://ede1a05.ngrok.com/treconomics/391485/
Django Version: 1.7
Python Version: 2.7.10
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'treconomics',
'survey',
'search')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/Users/mickeypash/.virtualenvs/treconomics3-dev/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
204. response = middleware_method(request, response)
File "/Users/mickeypash/.virtualenvs/treconomics3-dev/lib/python2.7/site-packages/django/contrib/sessions/middleware.py" in process_response
30. patch_vary_headers(response, ('Cookie',))
File "/Users/mickeypash/.virtualenvs/treconomics3-dev/lib/python2.7/site-packages/django/utils/cache.py" in patch_vary_headers
148. if response.has_header('Vary'):
Exception Type: AttributeError at /treconomics/391485/
Exception Value: 'str' object has no attribute 'has_header'
@joshokay
Copy link

Pls, have you found solution to this error after six years

@aliceridgway
Copy link

For anyone with a similiar problem, check your view.

I got the 'str' object has no attribute 'has_header' error message because my view returned a string instead of a HttpResponse object.

@mickeypash
Copy link
Author

^ That's right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment