2014-06-06 71 views
1

我移植一個項目從Django的1.3到1.5,我有這樣的錯誤:Django的錯誤與csrf_token

Environment: 


Request Method: GET 
Request URL: https://192.168.13.190/val/admin/ 

Django Version: 1.5.8 
Python Version: 2.7.3 
Installed Applications: 
('django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.staticfiles', 
'django.contrib.admin', 
'dxp.workflow2', 
'django_extensions', 
'south', 
'revisions', 
'dajax', 
'dajaxice', 
'django.contrib.admindocs') 
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', 
'revisions.middleware.VersionedModelRedirectMiddleware', 
'django.middleware.locale.LocaleMiddleware') 


Traceback: 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 
    138.      response = response.render() 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/response.py" in render 
    105.    self.content = self.rendered_content 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/response.py" in rendered_content 
    82.   content = template.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render 
    140.    return self._render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in _render 
    134.   return self.nodelist.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render 
    830.     bit = self.render_node(node, context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render_node 
    844.   return node.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/loader_tags.py" in render 
    124.   return compiled_parent._render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in _render 
    134.   return self.nodelist.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render 
    830.     bit = self.render_node(node, context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render_node 
    844.   return node.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/loader_tags.py" in render 
    124.   return compiled_parent._render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in _render 
    134.   return self.nodelist.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render 
    830.     bit = self.render_node(node, context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render_node 
    844.   return node.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/loader_tags.py" in render 
    63.    result = block.nodelist.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render 
    830.     bit = self.render_node(node, context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render_node 
    844.   return node.render(context) 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/base.py" in render 
    1208.       new_context['csrf_token'] = csrf_token 
File "/home/dxpadmin/lsf_env/lib/python2.7/site-packages/django/template/context.py" in __setitem__ 
    50.   self.dicts[-1][key] = value 

Exception Type: TypeError at /admin/ 
Exception Value: 'str' object does not support item assignment 

在日誌中我沒有看到該項目的代碼的任何關係,我我試圖在我的項目和middeware列表中停用csrf_token,但問題仍然存在

+0

您是否有任何正在返回字符串的上下文處理器? – Matt

回答