First time here? Check out the FAQ!

kovszilard's profile - activity

2016-03-08 09:24:49 -0600 received badge Self-Learner ( source )
2016-03-08 09:24:49 -0600 received badge Teacher ( source )
2016-03-08 09:24:40 -0600 received badge Student (source)
2016-03-08 09:12:18 -0600 received badge Notable Question (source)
2015-09-21 17:13:19 -0600 received badge Popular Question (source)
2015-06-18 06:08:53 -0600 received badge Famous Question (source)
2015-05-07 09:44:59 -0600 answered a question What is wrong with this cache setup?

According to django's documentation, there was a problem with Middleware ordering https://docs.djangoproject.com/en/1.8/ref/middleware/#middleware-ordering (link to doc)

Here is my working middleware config:

MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware',
#'django.middleware.gzip.GZipMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
## Enable the following middleware if you want to enable
## language selection in the site settings.
#'askbot.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
#'django.middleware.sqlprint.SqlPrintingMiddleware',

#below is askbot stuff for this tuple
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.forum_mode.ForumModeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
#'debug_toolbar.middleware.DebugToolbarMiddleware',
'askbot.middleware.view_log.ViewLogMiddleware',
'askbot.middleware.spaceless.SpacelessMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',

)

2015-05-07 04:32:04 -0600 received badge Organizer (source)
2015-05-07 04:23:51 -0600 asked a question What is wrong with this cache setup?

I have a problem with memcached setup. When i visit some pages anonymously everything works as expected, but after logging in all the previously visited pages looks like before authentication. This happens for example with /questions and the /users page. (I'm using ldap authentication, not sure if it has anything to do with this problem)

After clearing the cache by hand like this:

python manage.py shell
>>> from django.core.cache import cache
>>> cache.clear()

everything works perfectly.

here is the caching related part from my settings.py:

MIDDLEWARE_CLASSES = (
    ...
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.cache.FetchFromCacheMiddleware',
    ...
)

CACHES = {
    'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
            'TIMEOUT': 60,
            'KEY_PREFIX': 'askbot',
    }
}

CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

The intresting thing that even the 60 second cache period is over, I still get this pages from cache and the sign out link doesn't show up on top of the page.

some version numbers: askbot: 0.7.53, Python 2.6.6, Memcached 1.4.4, RedHatEnterpriseServer 6.5