annotate gpp/settings.py @ 467:b910cc1460c8

Add the ability to conditionally add model instances to the search index on update. This is not perfect, as some instances should be deleted from the index if they are updated such that they should not be in the index anymore. Will think about and address that later.
author Brian Neal <bgneal@gmail.com>
date Sun, 24 Jul 2011 18:12:20 +0000
parents 9a4bffdf37c3
children bbbc357ac5f3
rev   line source
gremmie@1 1 # Django settings for gpp project.
gremmie@1 2
gremmie@1 3 import os
gremmie@1 4 import platform
bgneal@38 5 from decimal import Decimal
bgneal@38 6
bgneal@436 7 from django.contrib.messages import constants as message_constants
bgneal@436 8
gremmie@1 9 import local_settings
bgneal@35 10
gremmie@1 11 project_path = os.path.abspath(os.path.split(__file__)[0])
gremmie@1 12
gremmie@1 13 DEBUG = local_settings.DEBUG
gremmie@1 14 TEMPLATE_DEBUG = DEBUG
gremmie@1 15
gremmie@1 16 ADMINS = (
gremmie@1 17 ('Brian Neal', 'admin@surfguitar101.com'),
gremmie@1 18 )
gremmie@1 19
gremmie@1 20 AUTH_PROFILE_MODULE = 'bio.userprofile'
gremmie@1 21
gremmie@1 22 MANAGERS = ADMINS
gremmie@1 23
bgneal@173 24 DATABASES = local_settings.DATABASES
gremmie@1 25
gremmie@1 26 INTERNAL_IPS = local_settings.INTERNAL_IPS
gremmie@1 27
gremmie@1 28 # Local time zone for this installation. Choices can be found here:
gremmie@1 29 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
gremmie@1 30 # although not all choices may be available on all operating systems.
gremmie@1 31 # If running in a Windows environment this must be set to the same as your
gremmie@1 32 # system time zone.
gremmie@1 33 TIME_ZONE = local_settings.TIME_ZONE
gremmie@1 34
gremmie@1 35 # Language code for this installation. All choices can be found here:
gremmie@1 36 # http://www.i18nguy.com/unicode/language-identifiers.html
gremmie@1 37 LANGUAGE_CODE = 'en-us'
gremmie@1 38
gremmie@1 39 SITE_ID = local_settings.SITE_ID
gremmie@1 40
gremmie@1 41 # If you set this to False, Django will make some optimizations so as not
gremmie@1 42 # to load the internationalization machinery.
gremmie@1 43 USE_I18N = False
gremmie@1 44
gremmie@1 45 # Absolute path to the directory that holds media.
gremmie@1 46 # Example: "/home/media/media.lawrence.com/"
gremmie@1 47 MEDIA_ROOT = local_settings.MEDIA_ROOT
gremmie@1 48
gremmie@1 49 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
gremmie@1 50 # trailing slash if there is a path component (optional in other cases).
gremmie@1 51 # Examples: "http://media.lawrence.com", "http://example.com/media/"
gremmie@1 52 MEDIA_URL = local_settings.MEDIA_URL
gremmie@1 53
gremmie@1 54 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
gremmie@1 55 # trailing slash.
gremmie@1 56 # Examples: "http://foo.com/media/", "/media/".
gremmie@1 57 ADMIN_MEDIA_PREFIX = local_settings.ADMIN_MEDIA_PREFIX
gremmie@1 58
bgneal@312 59 # Staticfiles settings:
bgneal@312 60 STATICFILES_DIRS = local_settings.STATICFILES_DIRS
bgneal@312 61 STATIC_ROOT = local_settings.STATIC_ROOT
bgneal@312 62 STATIC_URL = local_settings.STATIC_URL
bgneal@312 63
gremmie@1 64 # Make this unique, and don't share it with anybody.
gremmie@1 65 SECRET_KEY = local_settings.SECRET_KEY
gremmie@1 66
bgneal@174 67 # List of Loader classes that know how to import templates from various sources.
bgneal@181 68
bgneal@181 69 if DEBUG:
bgneal@181 70 TEMPLATE_LOADERS = (
bgneal@174 71 'django.template.loaders.filesystem.Loader',
bgneal@178 72 'django.template.loaders.app_directories.Loader',
bgneal@181 73 )
bgneal@181 74 else:
bgneal@181 75 TEMPLATE_LOADERS = (
bgneal@181 76 ('django.template.loaders.cached.Loader', (
bgneal@181 77 'django.template.loaders.filesystem.Loader',
bgneal@181 78 'django.template.loaders.app_directories.Loader',
bgneal@181 79 )),
bgneal@181 80 )
gremmie@1 81
bgneal@188 82 if DEBUG:
bgneal@188 83 MIDDLEWARE_CLASSES = (
bgneal@188 84 'django.middleware.common.CommonMiddleware',
bgneal@194 85 'django.middleware.csrf.CsrfViewMiddleware',
bgneal@188 86 'django.contrib.sessions.middleware.SessionMiddleware',
bgneal@188 87 'django.contrib.messages.middleware.MessageMiddleware',
bgneal@324 88 'debug_toolbar.middleware.DebugToolbarMiddleware',
bgneal@188 89 'django.contrib.auth.middleware.AuthenticationMiddleware',
bgneal@215 90 'gpp.core.middleware.InactiveUserMiddleware',
bgneal@227 91 'gpp.core.middleware.WhosOnline',
bgneal@188 92 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
bgneal@188 93 )
bgneal@188 94 else:
bgneal@188 95 MIDDLEWARE_CLASSES = (
bgneal@188 96 'django.middleware.common.CommonMiddleware',
bgneal@194 97 'django.middleware.csrf.CsrfViewMiddleware',
bgneal@188 98 'django.contrib.sessions.middleware.SessionMiddleware',
bgneal@188 99 'django.contrib.messages.middleware.MessageMiddleware',
bgneal@188 100 'django.contrib.auth.middleware.AuthenticationMiddleware',
bgneal@215 101 'gpp.core.middleware.InactiveUserMiddleware',
bgneal@227 102 'gpp.core.middleware.WhosOnline',
bgneal@188 103 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
bgneal@188 104 )
gremmie@1 105
gremmie@1 106 ROOT_URLCONF = 'gpp.urls'
gremmie@1 107
gremmie@1 108 TEMPLATE_DIRS = (
gremmie@1 109 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
gremmie@1 110 # Always use forward slashes, even on Windows.
gremmie@1 111 # Don't forget to use absolute paths, not relative paths.
gremmie@1 112 os.path.join(project_path, 'templates'),
gremmie@1 113 )
gremmie@1 114
gremmie@1 115 TEMPLATE_CONTEXT_PROCESSORS = (
bgneal@178 116 "django.contrib.auth.context_processors.auth",
bgneal@178 117 "django.core.context_processors.debug",
bgneal@178 118 "django.core.context_processors.request",
bgneal@178 119 "django.core.context_processors.media",
bgneal@312 120 "django.core.context_processors.static",
bgneal@178 121 "django.contrib.messages.context_processors.messages",
gremmie@1 122 )
gremmie@1 123
bgneal@188 124 INSTALLED_APPS = [
gremmie@1 125 'django.contrib.admin',
gremmie@1 126 'django.contrib.admindocs',
gremmie@1 127 'django.contrib.auth',
gremmie@1 128 'django.contrib.contenttypes',
bgneal@178 129 'django.contrib.flatpages',
bgneal@28 130 'django.contrib.humanize',
bgneal@178 131 'django.contrib.markup',
bgneal@178 132 'django.contrib.messages',
gremmie@1 133 'django.contrib.sessions',
gremmie@1 134 'django.contrib.sites',
bgneal@312 135 'django.contrib.staticfiles',
bgneal@29 136 'elsewhere',
gremmie@1 137 'tagging',
bgneal@219 138 'haystack',
bgneal@392 139 'queued_search',
gremmie@1 140 'accounts',
bgneal@214 141 'antispam',
gremmie@1 142 'bio',
gremmie@1 143 'bulletins',
gremmie@1 144 'comments',
gremmie@1 145 'contact',
gremmie@1 146 'core',
bgneal@33 147 'donations',
gremmie@1 148 'downloads',
bgneal@75 149 'forums',
gremmie@1 150 'gcalendar',
gremmie@1 151 'irc',
bgneal@290 152 'legacy',
bgneal@180 153 'mailer',
gremmie@1 154 'membermap',
gremmie@1 155 'messages',
gremmie@1 156 'news',
bgneal@285 157 'oembed',
gremmie@1 158 'podcast',
gremmie@1 159 'polls',
gremmie@1 160 'potd',
gremmie@1 161 'shoutbox',
gremmie@1 162 'smiley',
gremmie@1 163 'weblinks',
bgneal@323 164 'ygroup',
bgneal@188 165 ]
bgneal@324 166 if DEBUG:
bgneal@324 167 INSTALLED_APPS.append('debug_toolbar')
gremmie@1 168
gremmie@1 169 LOGIN_URL = '/accounts/login/'
gremmie@1 170 LOGIN_REDIRECT_URL = '/profile/me/'
gremmie@1 171 LOGOUT_URL = '/accounts/logout/'
gremmie@1 172
bgneal@57 173 FILE_UPLOAD_PERMISSIONS = 0644
bgneal@80 174 DEFAULT_FROM_EMAIL = ADMINS[0][1]
gremmie@1 175
gremmie@1 176 #######################################################################
bgneal@178 177 # Messages
bgneal@178 178 #######################################################################
bgneal@178 179 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
bgneal@436 180 MESSAGE_TAGS = {
bgneal@436 181 message_constants.DEBUG: 'notice',
bgneal@436 182 message_constants.INFO: 'info',
bgneal@436 183 message_constants.SUCCESS: 'success',
bgneal@436 184 message_constants.WARNING: 'alert',
bgneal@436 185 message_constants.ERROR: 'error',
bgneal@436 186 }
bgneal@178 187
bgneal@178 188 #######################################################################
bgneal@180 189 # Email
bgneal@180 190 #######################################################################
bgneal@180 191 EMAIL_HOST = local_settings.EMAIL_HOST
bgneal@180 192 EMAIL_PORT = local_settings.EMAIL_PORT
bgneal@180 193
bgneal@180 194 #######################################################################
bgneal@43 195 # Caching
bgneal@43 196 #######################################################################
bgneal@43 197 if local_settings.USE_CACHE:
bgneal@309 198 CACHES = local_settings.CACHES
bgneal@309 199 CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY
bgneal@248 200 CACHE_MIDDLEWARE_SECONDS = local_settings.CACHE_MIDDLEWARE_SECONDS
bgneal@248 201 CACHE_MIDDLEWARE_KEY_PREFIX = local_settings.CACHE_MIDDLEWARE_KEY_PREFIX
bgneal@43 202
bgneal@43 203 #######################################################################
bgneal@189 204 # Sessions
bgneal@189 205 #######################################################################
bgneal@189 206 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
bgneal@189 207 SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds
bgneal@189 208 SESSION_COOKIE_DOMAIN = None
bgneal@189 209 SESSION_COOKIE_NAME = 'sg101_sessionid'
bgneal@189 210 SESSION_COOKIE_PATH = '/'
bgneal@189 211 SESSION_COOKIE_SECURE = False
bgneal@189 212 SESSION_EXPIRE_AT_BROWSER_CLOSE = False
bgneal@189 213 SESSION_SAVE_EVERY_REQUEST = False
bgneal@189 214
bgneal@189 215 #######################################################################
gremmie@1 216 # Tagging Specific Settings
gremmie@1 217 #######################################################################
gremmie@1 218 FORCE_LOWERCASE_TAGS = True
gremmie@1 219 MAX_TAG_LENGTH = 50
gremmie@1 220
gremmie@1 221 #######################################################################
bgneal@219 222 # Haystack Search Settings
bgneal@219 223 #######################################################################
bgneal@219 224 HAYSTACK_SITECONF = 'gpp.search_sites'
bgneal@219 225 HAYSTACK_SEARCH_ENGINE = 'xapian'
bgneal@219 226 HAYSTACK_XAPIAN_PATH = os.path.join(project_path, 'xapian_index')
bgneal@219 227
bgneal@219 228
bgneal@219 229 #######################################################################
gremmie@1 230 # GPP Specific Settings
gremmie@1 231 #######################################################################
gremmie@1 232 GPP_LOG_LEVEL = 0
bgneal@180 233 GPP_SEND_EMAIL = local_settings.GPP_SEND_EMAIL # see MAILER_ENQUEUE_MAIL
gremmie@1 234 GPP_NO_REPLY_EMAIL = 'no_reply'
gremmie@1 235 AVATAR_DIR = 'avatars'
gremmie@1 236 MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024
gremmie@1 237 MAX_AVATAR_SIZE_PIXELS = 100
gremmie@1 238 AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png'
bgneal@36 239
bgneal@36 240 # Donations application settings:
bgneal@66 241 DONATIONS_DEBUG = local_settings.DONATIONS_DEBUG
bgneal@35 242 DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com'
bgneal@35 243 DONATIONS_BUSINESS = 'brian@surfguitar101.com'
bgneal@62 244 DONATIONS_BUSINESS_DEBUG = local_settings.DONATIONS_BUSINESS_DEBUG
bgneal@59 245 DONATIONS_GOAL = Decimal('100.00') # monthly goal
bgneal@35 246 DONATIONS_ANON_NAME = u'Anonymous'
bgneal@60 247 DONATIONS_ITEM_NUM = '500' # donation w/name listed
bgneal@60 248 DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous
bgneal@6 249
bgneal@180 250 # If MAILER_ENQUEUE_MAIL is True, all emails will be stored in the
bgneal@180 251 # mailer application's mail queue (database table). It is then expected
bgneal@180 252 # that a daemon or cron job will actually send the mail out. If
bgneal@180 253 # MAILER_ENQUEUE_MAIL is False, then email will only be sent if
bgneal@180 254 # the setting GPP_SEND_EMAIL (above) is True. In any event, emails
bgneal@180 255 # will be logged via the Python logger if the Python logger filter
bgneal@180 256 # DEBUG is active.
bgneal@180 257
bgneal@180 258 MAILER_ENQUEUE_MAIL = True
bgneal@180 259
bgneal@361 260 # Oembed settings
bgneal@361 261 OEMBED_MAXWIDTH = 480
bgneal@361 262 OEMBED_MAXHEIGHT = 295
bgneal@361 263
bgneal@451 264 # GCalendar settings
bgneal@451 265 GCAL_CALENDAR_ID = 'i81lu3fkh57sgqqenogefd9v78@group.calendar.google.com'
bgneal@451 266
bgneal@451 267 # Google OAuth settings
bgneal@451 268 GOOGLE_OAUTH_CONSUMER_KEY = local_settings.GOOGLE_OAUTH_CONSUMER_KEY
bgneal@451 269 GOOGLE_OAUTH_PRIVATE_KEY_PATH = local_settings.GOOGLE_OAUTH_PRIVATE_KEY_PATH
bgneal@451 270
bgneal@38 271 #######################################################################
bgneal@38 272 # Configure Logging
bgneal@38 273 #######################################################################
bgneal@38 274
bgneal@316 275 LOGGING = local_settings.LOGGING
bgneal@38 276
bgneal@206 277 #######################################################################
bgneal@206 278 # Django Debug Toolbar
bgneal@206 279 #######################################################################
bgneal@206 280
bgneal@206 281 if DEBUG:
bgneal@206 282 DEBUG_TOOLBAR_CONFIG = local_settings.DEBUG_TOOLBAR_CONFIG
bgneal@38 283
bgneal@38 284 #######################################################################
bgneal@392 285 # Asynchronous settings (queues, queued_search, redis, celery, etc)
bgneal@392 286 #######################################################################
bgneal@392 287 QUEUE_BACKEND = 'redisd'
bgneal@392 288 QUEUE_REDIS_CONNECTION = 'localhost:6379'
bgneal@392 289 QUEUE_REDIS_DB = 0
bgneal@392 290
bgneal@392 291 #######################################################################
bgneal@6 292 # URL's of 3rd party Javascript and CSS files.
bgneal@6 293 # These dictionaries are used by core/templatetags/script_tags, and
bgneal@6 294 # should also be used by developers when creating form media classes.
bgneal@6 295 GPP_THIRD_PARTY_JS = {
bgneal@6 296 'jquery': (
bgneal@425 297 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',
bgneal@6 298 ),
bgneal@6 299 'jquery-jeditable': (
bgneal@6 300 'js/jquery.jeditable.mini.js',
bgneal@6 301 ),
bgneal@6 302 'jquery-ui': (
bgneal@425 303 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js',
bgneal@6 304 ),
bgneal@6 305 'markitup': (
bgneal@6 306 'js/markitup/jquery.markitup.pack.js',
bgneal@6 307 'js/markitup/sets/markdown/set.js',
bgneal@6 308 ),
bgneal@7 309 'tiny_mce': (
bgneal@7 310 'js/tiny_mce/tiny_mce.js',
bgneal@7 311 'js/tiny_mce_init_std.js',
bgneal@7 312 ),
bgneal@6 313 }
bgneal@6 314 GPP_THIRD_PARTY_CSS = {
bgneal@6 315 'jquery-ui': (
bgneal@425 316 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css',
bgneal@6 317 ),
bgneal@6 318 'markitup': (
bgneal@6 319 'js/markitup/skins/markitup/style.css',
bgneal@6 320 'js/markitup/sets/markdown/style.css',
bgneal@6 321 ),
bgneal@6 322 }
bgneal@6 323