Created
August 4, 2015 17:58
-
-
Save anonymous/5c0fede63b2724d7880b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from celery.schedules import crontab | |
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS | |
import structlog | |
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
TEMPLATE_DEBUG = THUMBNAIL_DEBUG = DEBUG = False | |
USE_X_FORWARDED_HOST = True | |
EMAIL_HOST = 'smtp.mailgun.org' | |
EMAIL_PORT = 587 | |
EMAIL_USE_TLS = True | |
EMAIL_SUBJECT_PREFIX = '[Django ORD] ' | |
#audit trail settings | |
TRAILS_LOG_USER_ANONYMOUS = False | |
TRAILS_ADMIN_HISTORY = True | |
TRAILS_EXCLUDE = ['admin', 'hitcount'] | |
BANNER_EMAILS = ( | |
('x', 'x'), | |
('x', 'x') | |
) | |
SERVER_EMAIL = 'x' | |
DEFAULT_FROM_EMAIL = 'x' | |
DEFAULT_FROM_EMAIL_NAME = 'x' | |
JS_CSS_VERSION = 2 | |
DEFAULT_TO_EMAIL = 'x' | |
DEFAULT_TO_EMAIL_NAME = 'x' | |
GOOGLE_API_KEY = 'x' | |
MAILCHIMP_KEY = 'x' | |
MAILCHIMP_LIST_ID = 'x' #ORD Group Ltd | |
ALLOWED_HOSTS = ['*'] | |
SERIALIZATION_MODULES = { | |
'json': 'wadofstuff.django.serializers.custom_json' | |
} | |
#HitCounter settings | |
HITCOUNT_EXCLUDE_USER_GROUP = ('Advertising', 'Bookings', 'Website', 'Entries', | |
'About Pages', 'Agents') | |
HITCOUNT_KEEP_HIT_ACTIVE={'seconds':1} | |
ADMINS = ( | |
('x', 'x'), | |
) | |
MANAGERS = ADMINS | |
MPTT_ADMIN_LEVEL_INDENT = 20 | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | |
'NAME': 'x', # Or path to database file if using sqlite3. | |
'USER': 'x', # Not used with sqlite3. | |
'PASSWORD': 'x', # Not used with sqlite3. | |
'HOST': '', # Set to empty string for localhost. Not used with sqlite3. | |
'PORT': '', # Set to empty string for default. Not used with sqlite3. | |
}, | |
} | |
# Local time zone for this installation. Choices can be found here: | |
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | |
# although not all choices may be available on all operating systems. | |
# On Unix systems, a value of None will cause Django to use the same | |
# timezone as the operating system. | |
# If running in a Windows environment this must be set to the same as your | |
# system time zone. | |
TIME_ZONE = 'Africa/Nairobi' | |
# Language code for this installation. All choices can be found here: | |
# http://www.i18nguy.com/unicode/language-identifiers.html | |
LANGUAGE_CODE = 'en-uk' | |
SITE_ID = 2 | |
# If you set this to False, Django will make some optimizations so as not | |
# to load the internationalization machinery. | |
USE_I18N = True | |
# If you set this to False, Django will not format dates, numbers and | |
# calendars according to the current locale | |
USE_L10N = True | |
# If you set this to False, Django will not use timezone-aware datetimes. | |
USE_TZ = False | |
# Absolute path to the directory that holds media. | |
# Example: "/home/media/media.lawrence.com/" | |
MEDIA_ROOT = os.path.join(ROOT, 'media') | |
UPLOAD_DIR = 'uploads/' | |
# Absolute path to the directory static files should be collected to. | |
# Don't put anything in this directory yourself; store your static files | |
# in apps' "static/" subdirectories and in STATICFILES_DIRS. | |
# Example: "/home/media/media.lawrence.com/static/" | |
STATIC_ROOT = os.path.join(ROOT, 'static') | |
# URL prefix for static files. | |
# Example: "http://media.lawrence.com/static/" | |
STATIC_URL = '/static/' | |
# URL that handles the media served from MEDIA_ROOT. Make sure to use a | |
# trailing slash if there is a path component (optional in other cases). | |
# Examples: "http://media.lawrence.com", "http://example.com/media/" | |
MEDIA_URL = '/media/' | |
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a | |
# trailing slash. | |
# Examples: "http://foo.com/media/", "/media/". | |
#ADMIN_MEDIA_PREFIX = '/static/admin/' | |
# Make this unique, and don't share it with anybody. | |
SECRET_KEY = 'x' | |
# List of callables that know how to import templates from various sources. | |
TEMPLATE_CONTEXT_PROCESSORS = TEMPLATE_CONTEXT_PROCESSORS + ( | |
"common.context_processors.CommonContext", | |
) | |
TEMPLATE_LOADERS = ( | |
'django.template.loaders.filesystem.Loader', | |
'django.template.loaders.app_directories.Loader', | |
# 'django.template.loaders.eggs.Loader', | |
) | |
# Python dotted path to the WSGI application used by Django's runserver. | |
WSGI_APPLICATION = 'ord.wsgi.application' | |
MIDDLEWARE_CLASSES = ( | |
'django.middleware.cache.UpdateCacheMiddleware', | |
'django.middleware.gzip.GZipMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.csrf.CsrfViewMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
'django.contrib.redirects.middleware.RedirectFallbackMiddleware', | |
'django.middleware.cache.FetchFromCacheMiddleware', | |
'trails.middleware.CurrentRequestMiddleware', | |
) | |
ROOT_URLCONF = 'ord.urls' | |
TEMPLATE_DIRS = ( | |
os.path.join(ROOT, 'templates'), | |
) | |
HAYSTACK_CONNECTIONS = { | |
'default': { | |
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', | |
'PATH': os.path.join(ROOT, 'whoosh_index'), | |
'BATCH_SIZE': 100, | |
}, | |
} | |
CACHES = { | |
'default': { | |
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', | |
'LOCATION': '127.0.0.1:10536', | |
} | |
} | |
CACHE_MIDDLEWARE_ALIAS = "default" | |
CACHE_MIDDLEWARE_SECONDS = 36000 | |
CACHE_MIDDLEWARE_KEY_PREFIX = "ord" | |
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True | |
INSTALLED_APPS = ( | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.sites', | |
'django.contrib.staticfiles', | |
'django.contrib.messages', | |
'django.contrib.markup', | |
'django.contrib.humanize', | |
'django.contrib.redirects', | |
'django.contrib.admin', | |
'autocomplete_light', | |
'haystack', | |
'memcache_status', | |
'mptt', | |
'sorl.thumbnail', | |
'south', | |
'advertising', | |
'bookings', | |
'common', | |
'pages', | |
'search', | |
'resources', | |
'hitcount', | |
'widget_tweaks', | |
'trails', | |
) | |
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
# A sample logging configuration. The only tangible logging | |
# performed by this configuration is to send an email to | |
# the site admins on every HTTP 500 error when DEBUG=False. | |
# See http://docs.djangoproject.com/en/dev/topics/logging for | |
# more details on how to customize your logging configuration. | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'filters': { | |
'require_debug_false': { | |
'()': 'django.utils.log.RequireDebugFalse' | |
} | |
}, | |
'handlers': { | |
'mail_admins': { | |
'level': 'ERROR', | |
'filters': ['require_debug_false'], | |
'class': 'django.utils.log.AdminEmailHandler' | |
}, | |
'eastafrica_debug': { | |
'level': 'DEBUG', | |
'class': 'logging.FileHandler', | |
'filename': os.path.join(os.path.dirname(ROOT), 'log', 'eastafrica_debug.log') | |
} | |
}, | |
'loggers': { | |
'django.request': { | |
'handlers': ['mail_admins'], | |
'level': 'ERROR', | |
'propagate': True, | |
}, | |
'eastafrica_debug': { | |
'level': 'DEBUG', | |
'handlers': ['eastafrica_debug'] | |
} | |
} | |
} | |
#structlog | |
structlog.configure( | |
processors = [structlog.processors.KeyValueRenderer()], | |
logger_factory=structlog.stdlib.LoggerFactory() | |
) | |
#crontab | |
CELERYBEAT_SCHEDULE = { | |
'update_search_index': { | |
'task': 'update_search_index', | |
'schedule': crontab(minute=0, hour=0) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment