Ask Your Question
1

How can I enable pymemcach for the Askbot Django App?

asked 2023-04-17 16:31:44 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-04-17 16:32:06 +0000

david gravatar image

updated 2023-04-17 16:36:07 +0000

caching for production use

Replace CACHES config in settings.py file with this code part

CACHES = {
    'default': {
        'BACKEND': 'djpymemcache.backend.PyMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

Install memcached on linux env

sudo apt-get install memcached

or

yum install memcached

and install python library to work with memcache

pip install django-pymemcache

run the memcached service in daemon mode using this command

memcached -d

To activate memcached permanently do:

systemctl  start memcached
systemctl  enable memcached

Now run the Django application, It'll use the memcached service to cache the results.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

1 follower

Stats

Asked: 2023-04-17 16:31:44 +0000

Seen: 33 times

Last updated: Apr 17 '23