annotate gpp/settings.py @ 180:aef00df91165

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