Do PostgreSQL will be available in the cache of Askbot?

asked 2015-12-13 21:14:22 -0500

smori gravatar image

I make the settings using the django documentation.

ttps://docs.djangoproject.com/en/1.5/topics/cache/

However, internal server error occurs and access often. Cause is because the primary key of the cache table is duplicated. Do not use the PostgreSQL?

  • Now configuration.

1. Add settings to setting.py

CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', 'LOCATION': 'cache_table', 'KEY_PREFIX': 'askbot' } }

CACHE_TIMEOUT = 6000 LIVESETTINGS_CACHE_TIMEOUT = CACHE_TIMEOUT

CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

  1. run command $ python manage.py createcachetable cache_table
  • errors
  • WEB server error_log [Tue Dec 08 20:01:05 2015] [error] Traceback (most recent call last): [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/askbot/deps/livesettings/values.py", line 359, in _value [Tue Dec 08 20:01:05 2015] [error] val = self.setting.value [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/askbot/deps/livesettings/values.py", line 328, in _setting [Tue Dec 08 20:01:05 2015] [error] return find_setting(self.group.key, key) [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/askbot/deps/livesettings/models.py", line 43, in find_setting [Tue Dec 08 20:01:05 2015] [error] setting = cache_get(ck) [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/keyedcache/__init__.py", line 285, in cache_get [Tue Dec 08 20:01:05 2015] [error] obj = cache.get(key) [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/django/core/cache/backends/db.py", line 63, in get [Tue Dec 08 20:01:05 2015] [error] "WHERE cache_key = %%s" % table, [key]) [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 58, in execute [Tue Dec 08 20:01:05 2015] [error] six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2]) [Tue Dec 08 20:01:05 2015] [error] File "/usr/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 54, in execute [Tue Dec 08 20:01:05 2015] [error] return self.cursor.execute(query, args) [Tue Dec 08 20:01:05 2015] [error] DatabaseError: current transaction is aborted, commands ignored until end of transaction block
  1. PosgreSQL error Dec 8 14:27:29 cl01004 postgres[3765]: [3-1] ERROR: duplicate key value violates unique constraint "cache_table_pkey" Dec 8 14:27:29 cl01004 postgres[3765]: [3-2] STATEMENT: INSERT INTO "cache_table" (cache_key, value, expires) VALUES (E':1:django_compressor.mtime.5caeee78da81f4dd565952553c398b59', E'gAJHQdVggygCHu0u', E'2015-12-08 14:27:39') Dec 8 14:27:29 cl01004 postgres[3765]: [4-1] ERROR: duplicate key value violates unique constraint "cache_table_pkey" Dec 8 14:27:29 cl01004 postgres[3765]: [4-2] STATEMENT: INSERT INTO "cache_table" (cache_key, value, expires) VALUES (E':1:django_compressor.mtime.3c0dd16c253a99a0df3dd318891d6e72', E'gAJHQdVggygES/wu', E'2015-12-08 14:27:39')
edit retag flag offensive close merge delete