我创建了一个askbot项目
askbot-setup
和
python manage.py syncdb # answered 'no' when asked to create superuser account
python manage.py migrate
我从shell创建了一个超级用户:
from django.contrib.auth.models import User
User.objects.create_superuser('admin', admin@example.com', 'pass')
然后我运行开发服务器并通过浏览器访问本地主机
python manage.py runserver
一切似乎都很好。但是当我从管理页面注销时,会发生异常:
AttributeError at /admin/logout/
'AnonymousUser' object has no attribute 'get_and_delete_messages'
Request Method: GET
Request URL: http://localhost:8000/admin/logout/
Django Version: 1.5
Exception Type: AttributeError
Exception Value:
'AnonymousUser' object has no attribute 'get_and_delete_messages'
Exception Location: /usr/local/lib/python2.7/dist-packages/askbot/user_messages/context_processors.py in user_messages, line 21
Python Executable: /usr/bin/python
Python Version: 2.7.4
追溯:
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
140. response = response.render()
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in render
105. self.content = self.rendered_content
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in rendered_content
81. context = self.resolve_context(self.context_data)
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in resolve_context
159. return RequestContext(self._request, context, current_app=self._current_app)
File "/usr/local/lib/python2.7/dist-packages/django/template/context.py" in __init__
179. self.update(processor(request))
File "/usr/local/lib/python2.7/dist-packages/askbot/user_messages/context_processors.py" in user_messages
21. messages = request.user.get_and_delete_messages()
有什么帮助吗?