askbot-devel
askbot-devel copied to clipboard
AttributeError: 'AnonymousUser' object has no attribute 'message_set'
Internal Server Error: /askbot/forum/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 108, in get_response
response = middleware_method(request)
File "/usr/local/lib/python2.7/dist-packages/askbot/middleware/forum_mode.py", line 63, in process_request
request.user.message_set.create(
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 226, in inner
return func(self._wrapped, *args)
AttributeError: 'AnonymousUser' object has no attribute 'message_set'
Got this exception every time I browse the application without being logged in. If I'm logged in there is no problem.
Askbot is configured with mandatory login and everything is accessed through http://eample.com/askbot/forum URL like. Relevant apache conf looks like:
WSGIScriptAlias /askbot /var/www/django-site/django.wsgi
and settings.py:
ASKBOT_URL = 'forum/'
It is configured this way because there are others things served by apache. If I put askbot to be served at the root works well.
@albertfc I had the same issue when I had commented out askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware
from MIDDLEWARE_CLASSES
in the settings.py. You need to make sure that this middleware is included to resolve this issue: https://github.com/ASKBOT/askbot-devel/blob/7496d56a91e39e339accf5d53baaeb48902e7ec5/testproject/testproject/settings.py#L110