annotate gpp/settings.py @ 324:33f3d5987a96

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