diff options
Diffstat (limited to 'bitbake/lib/toaster/toastermain/settings.py')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 0974b90525..acc20cc11d 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -21,11 +21,15 @@ | |||
21 | 21 | ||
22 | # Django settings for Toaster project. | 22 | # Django settings for Toaster project. |
23 | 23 | ||
24 | import os, re | ||
25 | |||
24 | DEBUG = True | 26 | DEBUG = True |
25 | TEMPLATE_DEBUG = DEBUG | 27 | TEMPLATE_DEBUG = DEBUG |
26 | 28 | ||
27 | # Set to True to see the SQL queries in console | 29 | # Set to True to see the SQL queries in console |
28 | SQL_DEBUG = False | 30 | SQL_DEBUG = False |
31 | if os.environ.get("TOASTER_SQLDEBUG", None) is not None: | ||
32 | SQL_DEBUG = True | ||
29 | 33 | ||
30 | 34 | ||
31 | ADMINS = ( | 35 | ADMINS = ( |
@@ -46,7 +50,6 @@ DATABASES = { | |||
46 | } | 50 | } |
47 | 51 | ||
48 | # Reinterpret database settings if we have DATABASE_URL environment variable defined | 52 | # Reinterpret database settings if we have DATABASE_URL environment variable defined |
49 | import os, re | ||
50 | 53 | ||
51 | if 'DATABASE_URL' in os.environ: | 54 | if 'DATABASE_URL' in os.environ: |
52 | dburl = os.environ['DATABASE_URL'] | 55 | dburl = os.environ['DATABASE_URL'] |
@@ -212,6 +215,9 @@ MIDDLEWARE_CLASSES = ( | |||
212 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | 215 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
213 | ) | 216 | ) |
214 | 217 | ||
218 | from os.path import dirname as DN | ||
219 | SITE_ROOT=DN(DN(os.path.abspath(__file__))) | ||
220 | |||
215 | ROOT_URLCONF = 'toastermain.urls' | 221 | ROOT_URLCONF = 'toastermain.urls' |
216 | 222 | ||
217 | # Python dotted path to the WSGI application used by Django's runserver. | 223 | # Python dotted path to the WSGI application used by Django's runserver. |
@@ -245,6 +251,19 @@ INSTALLED_APPS = ( | |||
245 | 'south', | 251 | 'south', |
246 | ) | 252 | ) |
247 | 253 | ||
254 | |||
255 | # Load django-fresh is TOASTER_DEVEL is set, and the module is available | ||
256 | FRESH_ENABLED = False | ||
257 | if os.environ.get('TOASTER_DEVEL', None) is not None: | ||
258 | try: | ||
259 | import fresh | ||
260 | MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ("fresh.middleware.FreshMiddleware",) | ||
261 | INSTALLED_APPS = INSTALLED_APPS + ('fresh',) | ||
262 | FRESH_ENABLED = True | ||
263 | except: | ||
264 | pass | ||
265 | |||
266 | |||
248 | SOUTH_TESTS_MIGRATE = False | 267 | SOUTH_TESTS_MIGRATE = False |
249 | 268 | ||
250 | # if we run in managed mode, we need user support | 269 | # if we run in managed mode, we need user support |
@@ -286,7 +305,7 @@ LOGGING = { | |||
286 | }, | 305 | }, |
287 | 'formatters': { | 306 | 'formatters': { |
288 | 'datetime': { | 307 | 'datetime': { |
289 | 'format': 'DB %(asctime)s %(message)s' | 308 | 'format': '%(levelname)s %(asctime)s %(message)s' |
290 | } | 309 | } |
291 | }, | 310 | }, |
292 | 'handlers': { | 311 | 'handlers': { |
@@ -302,6 +321,10 @@ LOGGING = { | |||
302 | } | 321 | } |
303 | }, | 322 | }, |
304 | 'loggers': { | 323 | 'loggers': { |
324 | 'toaster' : { | ||
325 | 'handlers': ['console'], | ||
326 | 'level': 'DEBUG', | ||
327 | }, | ||
305 | 'django.request': { | 328 | 'django.request': { |
306 | 'handlers': ['mail_admins'], | 329 | 'handlers': ['mail_admins'], |
307 | 'level': 'ERROR', | 330 | 'level': 'ERROR', |