Search code examples
django-cms

django cms 'TemplateResponse' object has no attribute '_headers'


I am following the django-cms documentation and so far I only have one template home.html:

{% load cms_tags sekizai_tags %}
<html>
    <head>
        <title>{% page_attribute "page_title" %}</title>
        {% render_block "css" %}
    </head>
    <body>
        {% cms_toolbar %}
        {% placeholder "content" %}
        {% render_block "js" %}
    </body>
</html>

And my url.py looks like this:

from django.contrib import admin
from django.urls import path,  re_path, include


urlpatterns = [
    path('admin/', admin.site.urls),
    re_path(r'^', include('cms.urls')),
]

I can login and create a page, but when I logout and navigate to `localhost:8000' I get:

AttributeError at /
'TemplateResponse' object has no attribute '_headers'
Request Method: GET
Request URL:    http://localhost:8000/
Django Version: 3.2
Exception Type: AttributeError
Exception Value:    
'TemplateResponse' object has no attribute '_headers'
Exception Location: /usr/local/lib/python3.9/site-packages/cms/cache/page.py, line 84, in set_page_cache
Python Executable:  /usr/local/bin/python
Python Version: 3.9.4
Python Path:    
['/app/app',
 '/usr/local/lib/python39.zip',
 '/usr/local/lib/python3.9',
 '/usr/local/lib/python3.9/lib-dynload',
 '/usr/local/lib/python3.9/site-packages']

I am not sure if I did something wrong here. I would like to see how the webpage looks like for someone who does not have an account and cannot login.


Solution

  • Support for django 3.2 has been introduced in django-cms 3.9 so upgrade to this version to resolve this error.