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.
|
bgneal@181
|
62
|
bgneal@181
|
63 if DEBUG:
|
bgneal@181
|
64 TEMPLATE_LOADERS = (
|
bgneal@174
|
65 'django.template.loaders.filesystem.Loader',
|
bgneal@178
|
66 'django.template.loaders.app_directories.Loader',
|
bgneal@181
|
67 )
|
bgneal@181
|
68 else:
|
bgneal@181
|
69 TEMPLATE_LOADERS = (
|
bgneal@181
|
70 ('django.template.loaders.cached.Loader', (
|
bgneal@181
|
71 'django.template.loaders.filesystem.Loader',
|
bgneal@181
|
72 'django.template.loaders.app_directories.Loader',
|
bgneal@181
|
73 )),
|
bgneal@181
|
74 )
|
gremmie@1
|
75
|
bgneal@188
|
76 if DEBUG:
|
bgneal@188
|
77 MIDDLEWARE_CLASSES = (
|
bgneal@188
|
78 'django.middleware.common.CommonMiddleware',
|
bgneal@194
|
79 'django.middleware.csrf.CsrfViewMiddleware',
|
bgneal@188
|
80 'django.contrib.sessions.middleware.SessionMiddleware',
|
bgneal@188
|
81 'django.contrib.messages.middleware.MessageMiddleware',
|
bgneal@188
|
82 'debug_toolbar.middleware.DebugToolbarMiddleware',
|
bgneal@188
|
83 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
bgneal@188
|
84 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
bgneal@188
|
85 'gpp.forums.middleware.WhosOnline',
|
bgneal@188
|
86 )
|
bgneal@188
|
87 else:
|
bgneal@188
|
88 MIDDLEWARE_CLASSES = (
|
bgneal@188
|
89 'django.middleware.common.CommonMiddleware',
|
bgneal@194
|
90 'django.middleware.csrf.CsrfViewMiddleware',
|
bgneal@188
|
91 'django.contrib.sessions.middleware.SessionMiddleware',
|
bgneal@188
|
92 'django.contrib.messages.middleware.MessageMiddleware',
|
bgneal@188
|
93 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
bgneal@188
|
94 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
bgneal@188
|
95 'gpp.forums.middleware.WhosOnline',
|
bgneal@188
|
96 )
|
gremmie@1
|
97
|
gremmie@1
|
98 ROOT_URLCONF = 'gpp.urls'
|
gremmie@1
|
99
|
gremmie@1
|
100 TEMPLATE_DIRS = (
|
gremmie@1
|
101 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
gremmie@1
|
102 # Always use forward slashes, even on Windows.
|
gremmie@1
|
103 # Don't forget to use absolute paths, not relative paths.
|
gremmie@1
|
104 os.path.join(project_path, 'templates'),
|
bgneal@29
|
105 '/home/brian/coding/python/django/django-elsewhere/elsewhere/templates',
|
gremmie@1
|
106 )
|
gremmie@1
|
107
|
gremmie@1
|
108 TEMPLATE_CONTEXT_PROCESSORS = (
|
bgneal@178
|
109 "django.contrib.auth.context_processors.auth",
|
bgneal@178
|
110 "django.core.context_processors.debug",
|
bgneal@178
|
111 "django.core.context_processors.request",
|
bgneal@178
|
112 "django.core.context_processors.media",
|
bgneal@178
|
113 "django.contrib.messages.context_processors.messages",
|
gremmie@1
|
114 )
|
gremmie@1
|
115
|
bgneal@188
|
116 INSTALLED_APPS = [
|
gremmie@1
|
117 'django.contrib.admin',
|
gremmie@1
|
118 'django.contrib.admindocs',
|
gremmie@1
|
119 'django.contrib.auth',
|
gremmie@1
|
120 'django.contrib.contenttypes',
|
bgneal@178
|
121 'django.contrib.flatpages',
|
bgneal@28
|
122 'django.contrib.humanize',
|
bgneal@178
|
123 'django.contrib.markup',
|
bgneal@178
|
124 'django.contrib.messages',
|
gremmie@1
|
125 'django.contrib.sessions',
|
gremmie@1
|
126 'django.contrib.sites',
|
bgneal@29
|
127 'elsewhere',
|
gremmie@1
|
128 'tagging',
|
gremmie@1
|
129 'accounts',
|
gremmie@1
|
130 'bio',
|
gremmie@1
|
131 'bulletins',
|
gremmie@1
|
132 'comments',
|
gremmie@1
|
133 'contact',
|
gremmie@1
|
134 'core',
|
bgneal@33
|
135 'donations',
|
gremmie@1
|
136 'downloads',
|
bgneal@75
|
137 'forums',
|
gremmie@1
|
138 'gcalendar',
|
gremmie@1
|
139 'irc',
|
bgneal@180
|
140 'mailer',
|
gremmie@1
|
141 'membermap',
|
gremmie@1
|
142 'messages',
|
gremmie@1
|
143 'news',
|
gremmie@1
|
144 'podcast',
|
gremmie@1
|
145 'polls',
|
gremmie@1
|
146 'potd',
|
gremmie@1
|
147 'shoutbox',
|
gremmie@1
|
148 'smiley',
|
gremmie@1
|
149 'weblinks',
|
bgneal@188
|
150 ]
|
bgneal@188
|
151 if DEBUG:
|
bgneal@188
|
152 INSTALLED_APPS.append('debug_toolbar')
|
gremmie@1
|
153
|
gremmie@1
|
154 LOGIN_URL = '/accounts/login/'
|
gremmie@1
|
155 LOGIN_REDIRECT_URL = '/profile/me/'
|
gremmie@1
|
156 LOGOUT_URL = '/accounts/logout/'
|
gremmie@1
|
157
|
bgneal@57
|
158 FILE_UPLOAD_PERMISSIONS = 0644
|
bgneal@80
|
159 DEFAULT_FROM_EMAIL = ADMINS[0][1]
|
gremmie@1
|
160
|
gremmie@1
|
161 #######################################################################
|
bgneal@178
|
162 # Messages
|
bgneal@178
|
163 #######################################################################
|
bgneal@178
|
164 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
|
bgneal@178
|
165
|
bgneal@178
|
166 #######################################################################
|
bgneal@180
|
167 # Email
|
bgneal@180
|
168 #######################################################################
|
bgneal@180
|
169 EMAIL_HOST = local_settings.EMAIL_HOST
|
bgneal@180
|
170 EMAIL_PORT = local_settings.EMAIL_PORT
|
bgneal@180
|
171
|
bgneal@180
|
172 #######################################################################
|
bgneal@43
|
173 # Caching
|
bgneal@43
|
174 #######################################################################
|
bgneal@43
|
175 if local_settings.USE_CACHE:
|
bgneal@43
|
176 CACHE_BACKEND = local_settings.CACHE_BACKEND
|
bgneal@43
|
177 #CACHE_MIDDLEWARE_SECONDS = local_settings.CACHE_MIDDLEWARE_SECONDS
|
bgneal@43
|
178 #CACHE_MIDDLEWARE_KEY_PREFIX = local_settings.CACHE_MIDDLEWARE_KEY_PREFIX
|
bgneal@43
|
179 #CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY
|
bgneal@43
|
180
|
bgneal@43
|
181 #######################################################################
|
bgneal@189
|
182 # Sessions
|
bgneal@189
|
183 #######################################################################
|
bgneal@189
|
184 #SESSION_ENGINE = "django.contrib.sessions.backends.db"
|
bgneal@189
|
185 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
bgneal@189
|
186 SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds
|
bgneal@189
|
187 SESSION_COOKIE_DOMAIN = None
|
bgneal@189
|
188 SESSION_COOKIE_NAME = 'sg101_sessionid'
|
bgneal@189
|
189 SESSION_COOKIE_PATH = '/'
|
bgneal@189
|
190 SESSION_COOKIE_SECURE = False
|
bgneal@189
|
191 SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
bgneal@189
|
192 SESSION_SAVE_EVERY_REQUEST = False
|
bgneal@189
|
193
|
bgneal@189
|
194 #######################################################################
|
gremmie@1
|
195 # Tagging Specific Settings
|
gremmie@1
|
196 #######################################################################
|
gremmie@1
|
197 FORCE_LOWERCASE_TAGS = True
|
gremmie@1
|
198 MAX_TAG_LENGTH = 50
|
gremmie@1
|
199
|
gremmie@1
|
200 #######################################################################
|
gremmie@1
|
201 # GPP Specific Settings
|
gremmie@1
|
202 #######################################################################
|
gremmie@1
|
203 GPP_LOG_LEVEL = 0
|
bgneal@180
|
204 GPP_SEND_EMAIL = local_settings.GPP_SEND_EMAIL # see MAILER_ENQUEUE_MAIL
|
gremmie@1
|
205 GPP_NO_REPLY_EMAIL = 'no_reply'
|
gremmie@1
|
206 AVATAR_DIR = 'avatars'
|
gremmie@1
|
207 MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024
|
gremmie@1
|
208 MAX_AVATAR_SIZE_PIXELS = 100
|
gremmie@1
|
209 AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png'
|
bgneal@36
|
210
|
bgneal@36
|
211 # Donations application settings:
|
bgneal@66
|
212 DONATIONS_DEBUG = local_settings.DONATIONS_DEBUG
|
bgneal@35
|
213 DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com'
|
bgneal@35
|
214 DONATIONS_BUSINESS = 'brian@surfguitar101.com'
|
bgneal@62
|
215 DONATIONS_BUSINESS_DEBUG = local_settings.DONATIONS_BUSINESS_DEBUG
|
bgneal@59
|
216 DONATIONS_GOAL = Decimal('100.00') # monthly goal
|
bgneal@35
|
217 DONATIONS_ANON_NAME = u'Anonymous'
|
bgneal@60
|
218 DONATIONS_ITEM_NUM = '500' # donation w/name listed
|
bgneal@60
|
219 DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous
|
bgneal@6
|
220
|
bgneal@180
|
221 # If MAILER_ENQUEUE_MAIL is True, all emails will be stored in the
|
bgneal@180
|
222 # mailer application's mail queue (database table). It is then expected
|
bgneal@180
|
223 # that a daemon or cron job will actually send the mail out. If
|
bgneal@180
|
224 # MAILER_ENQUEUE_MAIL is False, then email will only be sent if
|
bgneal@180
|
225 # the setting GPP_SEND_EMAIL (above) is True. In any event, emails
|
bgneal@180
|
226 # will be logged via the Python logger if the Python logger filter
|
bgneal@180
|
227 # DEBUG is active.
|
bgneal@180
|
228
|
bgneal@180
|
229 MAILER_ENQUEUE_MAIL = True
|
bgneal@180
|
230
|
bgneal@38
|
231 #######################################################################
|
bgneal@38
|
232 # Configure Logging
|
bgneal@38
|
233 #######################################################################
|
bgneal@38
|
234
|
bgneal@38
|
235 logging.basicConfig(
|
bgneal@38
|
236 filename=os.path.join(project_path, 'logs', 'gpp.log'),
|
bgneal@38
|
237 filemode='a',
|
bgneal@38
|
238 format='%(asctime)s %(levelname)s %(message)s',
|
bgneal@38
|
239 level=local_settings.LOG_LEVEL)
|
bgneal@38
|
240
|
bgneal@206
|
241 #######################################################################
|
bgneal@206
|
242 # Django Debug Toolbar
|
bgneal@206
|
243 #######################################################################
|
bgneal@206
|
244
|
bgneal@206
|
245 if DEBUG:
|
bgneal@206
|
246 DEBUG_TOOLBAR_CONFIG = local_settings.DEBUG_TOOLBAR_CONFIG
|
bgneal@38
|
247
|
bgneal@38
|
248 #######################################################################
|
bgneal@6
|
249 # URL's of 3rd party Javascript and CSS files.
|
bgneal@6
|
250 # These dictionaries are used by core/templatetags/script_tags, and
|
bgneal@6
|
251 # should also be used by developers when creating form media classes.
|
bgneal@6
|
252 GPP_THIRD_PARTY_JS = {
|
bgneal@6
|
253 'jquery': (
|
bgneal@184
|
254 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js',
|
bgneal@6
|
255 ),
|
bgneal@6
|
256 'jquery-jeditable': (
|
bgneal@6
|
257 'js/jquery.jeditable.mini.js',
|
bgneal@6
|
258 ),
|
bgneal@6
|
259 'jquery-ui': (
|
bgneal@184
|
260 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js',
|
bgneal@6
|
261 ),
|
bgneal@6
|
262 'markitup': (
|
bgneal@6
|
263 'js/markitup/jquery.markitup.pack.js',
|
bgneal@6
|
264 'js/markitup/sets/markdown/set.js',
|
bgneal@6
|
265 ),
|
bgneal@7
|
266 'tiny_mce': (
|
bgneal@7
|
267 'js/tiny_mce/tiny_mce.js',
|
bgneal@7
|
268 'js/tiny_mce_init_std.js',
|
bgneal@7
|
269 ),
|
bgneal@6
|
270 }
|
bgneal@6
|
271 GPP_THIRD_PARTY_CSS = {
|
bgneal@6
|
272 'jquery-ui': (
|
bgneal@184
|
273 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/themes/redmond/jquery-ui.css',
|
bgneal@6
|
274 ),
|
bgneal@6
|
275 'markitup': (
|
bgneal@6
|
276 'js/markitup/skins/markitup/style.css',
|
bgneal@6
|
277 'js/markitup/sets/markdown/style.css',
|
bgneal@6
|
278 ),
|
bgneal@6
|
279 }
|
bgneal@6
|
280
|