summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastermain/settings.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-01-20 09:39:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-18 10:24:06 +0000
commitd086fa3aed34a05d52e73c255ca22379149a64a1 (patch)
treec55f38b6b86b513c0d4b47a01fed47c9db1cb163 /bitbake/lib/toaster/toastermain/settings.py
parentf99f2cdd69f1015953a7e9ab07af46dd63e50ad4 (diff)
downloadpoky-d086fa3aed34a05d52e73c255ca22379149a64a1.tar.gz
bitbake: toasterui: add extra debug and development infos
We update and add logs throughout the code in order to help with development. The extra logging is turned off by default, but it can be enabled by using environment variables. All logging happens through the Python logging facilities. The toaster UI will save a log of all incoming events if the TOASTER_EVENTLOG variable is set. If TOASTER_SQLDEBUG is set all DB queries will be logged. If TOASTER_DEVEL is set and the django-fresh module is available, the module is enabled to allow auto-reload of pages when the source is changed. (Bitbake rev: 10c27450601b4d24bbb273bd0e053498807d1060) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastermain/settings.py')
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py27
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
24import os, re
25
24DEBUG = True 26DEBUG = True
25TEMPLATE_DEBUG = DEBUG 27TEMPLATE_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
28SQL_DEBUG = False 30SQL_DEBUG = False
31if os.environ.get("TOASTER_SQLDEBUG", None) is not None:
32 SQL_DEBUG = True
29 33
30 34
31ADMINS = ( 35ADMINS = (
@@ -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
49import os, re
50 53
51if 'DATABASE_URL' in os.environ: 54if '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
218from os.path import dirname as DN
219SITE_ROOT=DN(DN(os.path.abspath(__file__)))
220
215ROOT_URLCONF = 'toastermain.urls' 221ROOT_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
256FRESH_ENABLED = False
257if 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
248SOUTH_TESTS_MIGRATE = False 267SOUTH_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',