annotate bns_website/settings/production.py @ 82:0e1f1e8db2a5

For issue #6, add caching to production settings.
author Brian Neal <bgneal@gmail.com>
date Fri, 25 Nov 2011 20:30:48 -0600
parents 6f68f6800843
children 4dca838ae291
rev   line source
bgneal@26 1 # Django production settings for bns_website project.
bgneal@26 2
bgneal@26 3 from settings.base import *
bgneal@26 4
bgneal@26 5 DEBUG = False
bgneal@26 6 TEMPLATE_DEBUG = DEBUG
bgneal@26 7
bgneal@26 8 DATABASES = {
bgneal@26 9 'default': {
bgneal@26 10 'ENGINE': 'django.db.backends.mysql',
bgneal@26 11 'NAME': 'bravenewsurf',
bgneal@26 12 'USER': SECRETS['DB_USER'],
bgneal@26 13 'PASSWORD': SECRETS['DB_PASSWORD'],
bgneal@26 14 },
bgneal@26 15 }
bgneal@26 16
bgneal@82 17 CACHES = {
bgneal@82 18 'default': {
bgneal@82 19 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
bgneal@82 20 'LOCATION': '127.0.0.1:11211',
bgneal@82 21 'TIMEOUT': 600,
bgneal@82 22 },
bgneal@82 23 }
bgneal@82 24
bgneal@82 25 CACHE_MIDDLEWARE_ALIAS = 'default'
bgneal@82 26 CACHE_MIDDLEWARE_SECONDS = 600
bgneal@82 27 CACHE_MIDDLEWARE_KEY_PREFIX = 'BNS'
bgneal@82 28 CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
bgneal@82 29
bgneal@82 30 MIDDLEWARE_CLASSES.insert(0, 'django.middleware.cache.UpdateCacheMiddleware')
bgneal@82 31 MIDDLEWARE_CLASSES.append('django.middleware.cache.FetchFromCacheMiddleware')
bgneal@82 32
bgneal@26 33 LOGGING = {
bgneal@26 34 'version': 1,
bgneal@26 35 'disable_existing_loggers': True,
bgneal@26 36 'formatters': {
bgneal@26 37 'verbose': {
bgneal@26 38 'format': '%(asctime)s %(levelname)s %(module)s %(process)d %(thread)d %(message)s'
bgneal@26 39 },
bgneal@26 40 'simple': {
bgneal@26 41 'format': '%(asctime)s %(levelname)s %(message)s'
bgneal@26 42 },
bgneal@26 43 },
bgneal@26 44 'handlers': {
bgneal@26 45 'console': {
bgneal@26 46 'class': 'logging.StreamHandler',
bgneal@26 47 'level': 'DEBUG',
bgneal@26 48 'formatter': 'simple',
bgneal@26 49 },
bgneal@26 50 'file': {
bgneal@26 51 'class': 'logging.handlers.RotatingFileHandler',
bgneal@26 52 'level': 'DEBUG',
bgneal@26 53 'formatter': 'simple',
bgneal@26 54 'filename': os.path.join(PROJECT_PATH, 'logs', 'bns.log'),
bgneal@26 55 'mode': 'a',
bgneal@26 56 'maxBytes': 100 * 1024,
bgneal@26 57 'backupCount': 10,
bgneal@26 58 },
bgneal@26 59 'mail_admins': {
bgneal@26 60 'class': 'django.utils.log.AdminEmailHandler',
bgneal@26 61 'level': 'ERROR',
bgneal@26 62 'formatter': 'simple',
bgneal@26 63 },
bgneal@26 64 },
bgneal@26 65 'loggers': {
bgneal@26 66 'django':{
bgneal@26 67 'level': 'ERROR',
bgneal@26 68 'propagate': False,
bgneal@26 69 'handlers': ['file'],
bgneal@26 70 },
bgneal@26 71 },
bgneal@26 72 'root': {
bgneal@26 73 'level': 'DEBUG',
bgneal@26 74 'handlers': ['file'],
bgneal@26 75 },
bgneal@26 76 }