Reputation: 207
We insert some static content in the admin panel. Inside our template we have a template tag that is passed the id for the content we want to display. For example {% contents 'introduction' %}
Each content section is one hit on the database. Number of such template tags is increasing. Performance is a critical issue: Under the above design: is there a way via which we can increase performance. And yet display all contents on appropriate locations?
Upvotes: 0
Views: 96
Reputation: 20780
Use a template cache. You would want to add this to your settings.py
. Just adjust the location. This is if you would like to use Memcached
:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
This will speed up your template loading. Here is the official documentation:
https://docs.djangoproject.com/en/dev/topics/cache/#setting-up-the-cache
Upvotes: 1