annotate gpp/settings/production.py @ 552:9e42e6618168

For bitbucket issue #2, tweak the admin settings for the Post model to reduce slow queries. Define our own queryset() method so we can control the select_related(), and not have it cascade from post to topics to forums to categories. Removed 'topic' from list_display because MySQL still sucked with 2 inner joins. Now it seems to be tolerable with only one join to User.
author Brian Neal <bgneal@gmail.com>
date Wed, 25 Jan 2012 20:07:03 -0600
parents 3fd369e1197f
children abc4be5a82e5
rev   line source
bgneal@499 1 """
bgneal@499 2 Production Django settings.
bgneal@499 3
bgneal@499 4 """
bgneal@499 5 from settings.base import *
bgneal@499 6
bgneal@499 7 DEBUG = False
bgneal@499 8
bgneal@499 9 DATABASES = {
bgneal@499 10 'default': {
bgneal@499 11 'ENGINE': 'django.db.backends.mysql',
bgneal@499 12 'NAME': 'gremmies_portal',
bgneal@499 13 'USER': SECRETS['DB_USER'],
bgneal@499 14 'PASSWORD': SECRETS['DB_PASSWORD'],
bgneal@499 15 },
bgneal@499 16 }
bgneal@499 17
bgneal@499 18 # Path to elsewhere application static images
bgneal@499 19 STATICFILES_DIRS.append(('elsewhere',
bgneal@511 20 '/home/var/django-sites/virtualenvs/sg101/src/django-elsewhere/elsewhere/img'))
bgneal@499 21
bgneal@499 22 STATIC_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static_serve'))
bgneal@499 23
bgneal@499 24 # Used cached template loader
bgneal@499 25 TEMPLATE_LOADERS = [
bgneal@499 26 ('django.template.loaders.cached.Loader', (
bgneal@499 27 'django.template.loaders.filesystem.Loader',
bgneal@499 28 'django.template.loaders.app_directories.Loader',
bgneal@499 29 )),
bgneal@499 30 ]
bgneal@499 31
bgneal@499 32 CACHES = {
bgneal@499 33 'default': {
bgneal@499 34 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
bgneal@499 35 'LOCATION': '127.0.0.1:11211',
bgneal@499 36 'TIMEOUT': 600,
bgneal@499 37 },
bgneal@499 38 }
bgneal@499 39 CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
bgneal@499 40 CACHE_MIDDLEWARE_SECONDS = 600
bgneal@499 41 CACHE_MIDDLEWARE_KEY_PREFIX = ''
bgneal@499 42
bgneal@499 43 EMAIL_HOST = 'localhost'
bgneal@499 44 EMAIL_PORT = 25
bgneal@512 45 EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
bgneal@499 46
bgneal@499 47 DONATIONS_DEBUG = False
bgneal@499 48
bgneal@499 49 # Logging configuration
bgneal@499 50
bgneal@499 51 LOGGING = {
bgneal@499 52 'version': 1,
bgneal@499 53 'disable_existing_loggers': True,
bgneal@499 54 'formatters': {
bgneal@499 55 'verbose': {
bgneal@499 56 'format': '%(asctime)s %(levelname)s %(module)s %(process)d %(thread)d %(message)s'
bgneal@499 57 },
bgneal@499 58 'simple': {
bgneal@499 59 'format': '%(asctime)s %(levelname)s %(message)s'
bgneal@499 60 },
bgneal@499 61 },
bgneal@499 62 'handlers': {
bgneal@499 63 'console': {
bgneal@499 64 'class': 'logging.StreamHandler',
bgneal@499 65 'level': 'DEBUG',
bgneal@499 66 'formatter': 'simple',
bgneal@499 67 },
bgneal@499 68 'file': {
bgneal@499 69 'class': 'logging.handlers.RotatingFileHandler',
bgneal@499 70 'level': 'DEBUG',
bgneal@499 71 'formatter': 'simple',
bgneal@499 72 'filename': os.path.join(PROJECT_PATH, 'logs', 'sg101.log'),
bgneal@499 73 'mode': 'a',
bgneal@499 74 'maxBytes': 100 * 1024,
bgneal@499 75 'backupCount': 10,
bgneal@499 76 },
bgneal@499 77 'mail_admins': {
bgneal@499 78 'class': 'django.utils.log.AdminEmailHandler',
bgneal@499 79 'level': 'ERROR',
bgneal@499 80 'formatter': 'simple',
bgneal@499 81 },
bgneal@499 82 },
bgneal@499 83 'loggers': {
bgneal@499 84 'django':{
bgneal@499 85 'level': 'WARNING',
bgneal@499 86 'propagate': False,
bgneal@499 87 'handlers': ['file'],
bgneal@499 88 },
bgneal@499 89 'django.request':{
bgneal@499 90 'level': 'ERROR',
bgneal@499 91 'propagate': True,
bgneal@499 92 'handlers': ['mail_admins'],
bgneal@499 93 },
bgneal@499 94 },
bgneal@499 95 'root': {
bgneal@499 96 'level': 'INFO',
bgneal@499 97 'handlers': ['file'],
bgneal@499 98 },
bgneal@499 99 }