annotate bns_website/settings/base.py @ 27:a5e8741452a3

Add path to Django in WSGI file. Use Django's simplesjon module as it will either import the Python system one if it exists, or use the one provided with Django as a fallback. This is needed for the production server, which is running Python 2.5.
author Brian Neal <bgneal@gmail.com>
date Tue, 01 Nov 2011 20:15:21 -0500
parents 6f68f6800843
children ced908af601a
rev   line source
bgneal@1 1 # Django base settings for bns_website project.
bgneal@1 2
bgneal@27 3 import django.utils.simplejson as json
bgneal@1 4 import os
bgneal@1 5
bgneal@1 6 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..'))
bgneal@0 7
bgneal@0 8 DEBUG = True
bgneal@0 9 TEMPLATE_DEBUG = DEBUG
bgneal@0 10
bgneal@1 11 ADMINS = [
bgneal@26 12 ('Bob Mourlam', 'bob.mourlam@gmail.com'),
bgneal@1 13 ('Brian Neal', 'bgneal@gmail.com'),
bgneal@26 14 ('Chris Ridgway', 'ckridgway@gmail.com'),
bgneal@1 15 ]
bgneal@0 16
bgneal@0 17 MANAGERS = ADMINS
bgneal@0 18
bgneal@0 19 # Local time zone for this installation. Choices can be found here:
bgneal@0 20 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
bgneal@0 21 # although not all choices may be available on all operating systems.
bgneal@0 22 # On Unix systems, a value of None will cause Django to use the same
bgneal@0 23 # timezone as the operating system.
bgneal@0 24 # If running in a Windows environment this must be set to the same as your
bgneal@0 25 # system time zone.
bgneal@0 26 TIME_ZONE = 'America/Chicago'
bgneal@0 27
bgneal@0 28 # Language code for this installation. All choices can be found here:
bgneal@0 29 # http://www.i18nguy.com/unicode/language-identifiers.html
bgneal@0 30 LANGUAGE_CODE = 'en-us'
bgneal@0 31
bgneal@0 32 SITE_ID = 1
bgneal@0 33
bgneal@0 34 # If you set this to False, Django will make some optimizations so as not
bgneal@0 35 # to load the internationalization machinery.
bgneal@1 36 USE_I18N = False
bgneal@0 37
bgneal@0 38 # If you set this to False, Django will not format dates, numbers and
bgneal@0 39 # calendars according to the current locale
bgneal@0 40 USE_L10N = True
bgneal@0 41
bgneal@0 42 # Absolute filesystem path to the directory that will hold user-uploaded files.
bgneal@0 43 # Example: "/home/media/media.lawrence.com/media/"
bgneal@26 44 MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', '..', 'media'))
bgneal@0 45
bgneal@0 46 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
bgneal@0 47 # trailing slash.
bgneal@0 48 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
bgneal@1 49 MEDIA_URL = '/media/'
bgneal@0 50
bgneal@0 51 # Absolute path to the directory static files should be collected to.
bgneal@0 52 # Don't put anything in this directory yourself; store your static files
bgneal@0 53 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
bgneal@0 54 # Example: "/home/media/media.lawrence.com/static/"
bgneal@26 55 STATIC_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', '..', 'static'))
bgneal@0 56
bgneal@0 57 # URL prefix for static files.
bgneal@0 58 # Example: "http://media.lawrence.com/static/"
bgneal@0 59 STATIC_URL = '/static/'
bgneal@0 60
bgneal@0 61 # URL prefix for admin static files -- CSS, JavaScript and images.
bgneal@0 62 # Make sure to use a trailing slash.
bgneal@0 63 # Examples: "http://foo.com/static/admin/", "/static/admin/".
bgneal@0 64 ADMIN_MEDIA_PREFIX = '/static/admin/'
bgneal@0 65
bgneal@0 66 # Additional locations of static files
bgneal@1 67 STATICFILES_DIRS = [
bgneal@0 68 # Put strings here, like "/home/html/static" or "C:/www/django/static".
bgneal@0 69 # Always use forward slashes, even on Windows.
bgneal@0 70 # Don't forget to use absolute paths, not relative paths.
bgneal@1 71 os.path.join(PROJECT_PATH, 'static'),
bgneal@1 72 ]
bgneal@0 73
bgneal@0 74 # List of finder classes that know how to find static files in
bgneal@0 75 # various locations.
bgneal@0 76 STATICFILES_FINDERS = (
bgneal@0 77 'django.contrib.staticfiles.finders.FileSystemFinder',
bgneal@0 78 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
bgneal@0 79 # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
bgneal@0 80 )
bgneal@0 81
bgneal@0 82 # Make this unique, and don't share it with anybody.
bgneal@1 83 SECRETS = json.load(open(os.path.join(PROJECT_PATH, 'settings', 'secrets.json')))
bgneal@1 84 SECRET_KEY = SECRETS['SECRET_KEY']
bgneal@0 85
bgneal@0 86 # List of callables that know how to import templates from various sources.
bgneal@0 87 TEMPLATE_LOADERS = (
bgneal@0 88 'django.template.loaders.filesystem.Loader',
bgneal@0 89 'django.template.loaders.app_directories.Loader',
bgneal@0 90 # 'django.template.loaders.eggs.Loader',
bgneal@0 91 )
bgneal@0 92
bgneal@1 93 MIDDLEWARE_CLASSES = [
bgneal@0 94 'django.middleware.common.CommonMiddleware',
bgneal@0 95 'django.contrib.sessions.middleware.SessionMiddleware',
bgneal@0 96 'django.middleware.csrf.CsrfViewMiddleware',
bgneal@0 97 'django.contrib.auth.middleware.AuthenticationMiddleware',
bgneal@0 98 'django.contrib.messages.middleware.MessageMiddleware',
bgneal@1 99 ]
bgneal@0 100
bgneal@0 101 ROOT_URLCONF = 'bns_website.urls'
bgneal@0 102
bgneal@1 103 TEMPLATE_DIRS = [
bgneal@0 104 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
bgneal@0 105 # Always use forward slashes, even on Windows.
bgneal@0 106 # Don't forget to use absolute paths, not relative paths.
bgneal@1 107 os.path.join(PROJECT_PATH, 'templates'),
bgneal@1 108 ]
bgneal@0 109
bgneal@1 110 TEMPLATE_CONTEXT_PROCESSORS = [
bgneal@1 111 'django.contrib.auth.context_processors.auth',
bgneal@1 112 'django.core.context_processors.debug',
bgneal@1 113 'django.core.context_processors.request',
bgneal@1 114 'django.core.context_processors.media',
bgneal@1 115 'django.core.context_processors.static',
bgneal@1 116 ]
bgneal@1 117
bgneal@1 118 INSTALLED_APPS = [
bgneal@0 119 'django.contrib.auth',
bgneal@0 120 'django.contrib.contenttypes',
bgneal@0 121 'django.contrib.sessions',
bgneal@0 122 'django.contrib.sites',
bgneal@0 123 'django.contrib.messages',
bgneal@0 124 'django.contrib.staticfiles',
bgneal@1 125 'django.contrib.admin',
bgneal@1 126 'django.contrib.admindocs',
bgneal@3 127 'core',
bgneal@6 128 'bands',
bob@14 129 'news',
ckridgway@16 130 'reviews',
bgneal@1 131 ]
bgneal@0 132
bgneal@0 133 # A sample logging configuration. The only tangible logging
bgneal@0 134 # performed by this configuration is to send an email to
bgneal@0 135 # the site admins on every HTTP 500 error.
bgneal@0 136 # See http://docs.djangoproject.com/en/dev/topics/logging for
bgneal@0 137 # more details on how to customize your logging configuration.
bgneal@0 138 LOGGING = {
bgneal@0 139 'version': 1,
bgneal@0 140 'disable_existing_loggers': False,
bgneal@0 141 'handlers': {
bgneal@0 142 'mail_admins': {
bgneal@0 143 'level': 'ERROR',
bgneal@0 144 'class': 'django.utils.log.AdminEmailHandler'
bgneal@0 145 }
bgneal@0 146 },
bgneal@0 147 'loggers': {
bgneal@0 148 'django.request': {
bgneal@0 149 'handlers': ['mail_admins'],
bgneal@0 150 'level': 'ERROR',
bgneal@0 151 'propagate': True,
bgneal@0 152 },
bgneal@0 153 }
bgneal@0 154 }