Commit f15c20d6 authored by David Haynes's avatar David Haynes 🙆

Enable cacheing on top-level pages plus redis server cache

- Redis server cache line copy-pasted from settings.py in bookshare
parent 9bf2c03a
......@@ -168,4 +168,13 @@ HAYSTACK_CONNECTIONS = {
# they are created -- in real time.
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
# Use redis cache when not in local development
if DEBUG:
pass
else:
CACHES = {
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': '/var/run/redis/redis.sock',
},
}
......@@ -3,7 +3,7 @@ from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from django.contrib import admin
from django.views.decorators.cache import cache_page
admin.autodiscover()
admin.site.login = login_required(admin.site.login)
......@@ -14,9 +14,15 @@ handle500 = TemplateView.as_view(template_name="500.html")
urlpatterns = patterns('',
# project-level urls
url(r'^$', TemplateView.as_view(template_name="index.html"), name='index'),
url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'),
url(r'^privacy/$', TemplateView.as_view(template_name='privacy.html'), name='privacy'),
url(r'^$',
cache_page(4)(TemplateView.as_view(template_name="index.html")),
name='index'),
url(r'^about/$',
cache_page(60 * 15)(TemplateView.as_view(template_name='about.html')),
name='about'),
url(r'^privacy/$',
cache_page(60 * 15)(TemplateView.as_view(template_name='privacy.html')),
name='privacy'),
# app-level urls
url(r'^housing/', include('housing.urls')),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment