Просмотр исходного кода

Document sandbox settings file

Thought it might be useful to comment on the Oscar-specific settings.
master
David Winterbottom 13 лет назад
Родитель
Сommit
997e317e00
1 измененных файлов: 39 добавлений и 25 удалений
  1. 39
    25
      sites/sandbox/settings.py

+ 39
- 25
sites/sandbox/settings.py Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 import os
2 2
 
3
-# Django settings for oscar project.
3
+# Path helper
4 4
 PROJECT_DIR = os.path.dirname(__file__)
5 5
 location = lambda x: os.path.join(
6 6
     os.path.dirname(os.path.realpath(__file__)), x)
@@ -11,6 +11,7 @@ DEBUG = True
11 11
 TEMPLATE_DEBUG = True
12 12
 SQL_DEBUG = True
13 13
 SEND_BROKEN_LINK_EMAILS = True
14
+THUMBNAIL_DEBUG = True
14 15
 
15 16
 ADMINS = (
16 17
     ('David Winterbottom', 'david.winterbottom@tangentlabs.co.uk'),
@@ -20,6 +21,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
20 21
 
21 22
 MANAGERS = ADMINS
22 23
 
24
+# Use a Sqlite database by default
23 25
 DATABASES = {
24 26
     'default': {
25 27
         'ENGINE': 'django.db.backends.sqlite3',
@@ -79,7 +81,7 @@ USE_L10N = True
79 81
 
80 82
 # Absolute path to the directory that holds media.
81 83
 # Example: "/home/media/media.lawrence.com/"
82
-MEDIA_ROOT = location("assets/media")
84
+MEDIA_ROOT = location("public/media")
83 85
 
84 86
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
85 87
 # trailing slash if there is a path component (optional in other cases).
@@ -135,8 +137,10 @@ MIDDLEWARE_CLASSES = (
135 137
     'django.middleware.transaction.TransactionMiddleware',
136 138
     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
137 139
     'debug_toolbar.middleware.DebugToolbarMiddleware',
138
-    # Oscar middleware
140
+    # Ensure a valid basket is added to the request instance for every request
139 141
     'oscar.apps.basket.middleware.BasketMiddleware',
142
+    # Enable the ProfileMiddleware, then add ?cprofile to any
143
+    # URL path to print out profile details
140 144
     #'oscar.middleware.profiling.ProfileMiddleware',
141 145
 )
142 146
 
@@ -144,6 +148,8 @@ INTERNAL_IPS = ('127.0.0.1',)
144 148
 
145 149
 ROOT_URLCONF = 'urls'
146 150
 
151
+# Add another path to Oscar's templates.  This allows templates to be
152
+# customised easily.
147 153
 from oscar import OSCAR_MAIN_TEMPLATE_DIR
148 154
 TEMPLATE_DIRS = (
149 155
     location('templates'),
@@ -177,28 +183,28 @@ LOGGING = {
177 183
             'formatter': 'verbose'
178 184
         },
179 185
         'checkout_file': {
180
-             'level': 'INFO',
181
-             'class': 'oscar.core.logging.handlers.EnvFileHandler',
182
-             'filename': 'checkout.log',
183
-             'formatter': 'verbose'
186
+            'level': 'INFO',
187
+            'class': 'oscar.core.logging.handlers.EnvFileHandler',
188
+            'filename': 'checkout.log',
189
+            'formatter': 'verbose'
184 190
         },
185 191
         'gateway_file': {
186
-             'level': 'INFO',
187
-             'class': 'oscar.core.logging.handlers.EnvFileHandler',
188
-             'filename': 'gateway.log',
189
-             'formatter': 'simple'
192
+            'level': 'INFO',
193
+            'class': 'oscar.core.logging.handlers.EnvFileHandler',
194
+            'filename': 'gateway.log',
195
+            'formatter': 'simple'
190 196
         },
191 197
         'error_file': {
192
-             'level': 'INFO',
193
-             'class': 'oscar.core.logging.handlers.EnvFileHandler',
194
-             'filename': 'errors.log',
195
-             'formatter': 'verbose'
198
+            'level': 'INFO',
199
+            'class': 'oscar.core.logging.handlers.EnvFileHandler',
200
+            'filename': 'errors.log',
201
+            'formatter': 'verbose'
196 202
         },
197 203
         'sorl_file': {
198
-             'level': 'INFO',
199
-             'class': 'oscar.core.logging.handlers.EnvFileHandler',
200
-             'filename': 'sorl.log',
201
-             'formatter': 'verbose'
204
+            'level': 'INFO',
205
+            'class': 'oscar.core.logging.handlers.EnvFileHandler',
206
+            'filename': 'sorl.log',
207
+            'formatter': 'verbose'
202 208
         },
203 209
         'mail_admins': {
204 210
             'level': 'ERROR',
@@ -252,14 +258,16 @@ INSTALLED_APPS = [
252 258
     'django_extensions',
253 259
     'debug_toolbar',
254 260
     'south',
255
-    'rosetta',  # For i18n testing
261
+    'rosetta',          # For i18n testing
256 262
     'compressor',
257
-    'apps.user',  # For profile testing
258
-    'apps.gateway',  # For allowing dashboard access
263
+    'apps.user',        # For profile testing
264
+    'apps.gateway',     # For allowing dashboard access
259 265
 ]
260 266
 from oscar import get_core_apps
261 267
 INSTALLED_APPS = INSTALLED_APPS + get_core_apps()
262 268
 
269
+# Add Oscar's custom auth backend so users can sign in using their email
270
+# address.
263 271
 AUTHENTICATION_BACKENDS = (
264 272
     'oscar.apps.customer.auth_backends.Emailbackend',
265 273
     'django.contrib.auth.backends.ModelBackend',
@@ -276,6 +284,7 @@ HAYSTACK_CONNECTIONS = {
276 284
     },
277 285
 }
278 286
 
287
+
279 288
 # Allow internal IPs to see the debug toolbar.  This is just for Tangent's QA
280 289
 # department to be able to create better issues when something goes wrong.
281 290
 def is_internal(request):
@@ -294,6 +303,8 @@ from oscar.defaults import *
294 303
 
295 304
 OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
296 305
 OSCAR_ALLOW_ANON_CHECKOUT = True
306
+
307
+# Some sample order/line status settings
297 308
 OSCAR_INITIAL_ORDER_STATUS = 'Pending'
298 309
 OSCAR_INITIAL_LINE_STATUS = 'Pending'
299 310
 OSCAR_ORDER_STATUS_PIPELINE = {
@@ -308,6 +319,7 @@ OSCAR_SHOP_TAGLINE = 'e-Commerce for Django'
308 319
 # Enter Google Analytics ID for the tracking to be included in the templates
309 320
 #GOOGLE_ANALYTICS_ID = 'UA-XXXXX-Y'
310 321
 
322
+# Use Less to compile CSS
311 323
 COMPRESS_ENABLED = True
312 324
 COMPRESS_PRECOMPILERS = (
313 325
     ('text/less', 'lessc {infile} {outfile}'),
@@ -318,13 +330,15 @@ LOG_ROOT = location('logs')
318 330
 if not os.path.exists(LOG_ROOT):
319 331
     os.mkdir(LOG_ROOT)
320 332
 
333
+# This is added to each template context by the core context processor.  It is
334
+# useful for test/stage/qa sites where you want to show the version of the site
335
+# in the page title.
321 336
 DISPLAY_VERSION = False
322 337
 
323
-THUMBNAIL_DEBUG = True
324
-
325
-# Must be within MEDIA_ROOT for sorl to work
338
+# Must be within MEDIA_ROOT for sorl to work which is a bit annoying.
326 339
 OSCAR_MISSING_IMAGE_URL = 'image_not_found.jpg'
327 340
 
341
+# Try and import local settings which can be used to override any of the above.
328 342
 try:
329 343
     from settings_local import *
330 344
 except ImportError:

Загрузка…
Отмена
Сохранить