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.
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
Asked: 2023-04-17 16:31:44 +0000
Seen: 33 times
Last updated: Apr 17 '23
How can I enable Python Code Highlighting in Askbot?
How to reset the Askbot Database:
How can I set up Gunicorn with a Django Project?
How can I change the Django Admin Password?
How can mutual authentication be implemented on a development server for a Django web application?
What is the reason for the Django channels websocket resulting in a 404 error?
In Django, why are the fields from the parent class not included in the table of the child class?
How can a red asterisk (*) be shown in Django forms?
How can we specify the database in which a model (table) should be created in Django?