mirror of
https://git.yoctoproject.org/poky
synced 2026-09-16 09:49:35 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
f99f2cdd69
commit
d086fa3aed
@@ -21,11 +21,15 @@
|
||||
|
||||
# Django settings for Toaster project.
|
||||
|
||||
import os, re
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
# Set to True to see the SQL queries in console
|
||||
SQL_DEBUG = False
|
||||
if os.environ.get("TOASTER_SQLDEBUG", None) is not None:
|
||||
SQL_DEBUG = True
|
||||
|
||||
|
||||
ADMINS = (
|
||||
@@ -46,7 +50,6 @@ DATABASES = {
|
||||
}
|
||||
|
||||
# Reinterpret database settings if we have DATABASE_URL environment variable defined
|
||||
import os, re
|
||||
|
||||
if 'DATABASE_URL' in os.environ:
|
||||
dburl = os.environ['DATABASE_URL']
|
||||
@@ -212,6 +215,9 @@ MIDDLEWARE_CLASSES = (
|
||||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
|
||||
from os.path import dirname as DN
|
||||
SITE_ROOT=DN(DN(os.path.abspath(__file__)))
|
||||
|
||||
ROOT_URLCONF = 'toastermain.urls'
|
||||
|
||||
# Python dotted path to the WSGI application used by Django's runserver.
|
||||
@@ -245,6 +251,19 @@ INSTALLED_APPS = (
|
||||
'south',
|
||||
)
|
||||
|
||||
|
||||
# Load django-fresh is TOASTER_DEVEL is set, and the module is available
|
||||
FRESH_ENABLED = False
|
||||
if os.environ.get('TOASTER_DEVEL', None) is not None:
|
||||
try:
|
||||
import fresh
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ("fresh.middleware.FreshMiddleware",)
|
||||
INSTALLED_APPS = INSTALLED_APPS + ('fresh',)
|
||||
FRESH_ENABLED = True
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
SOUTH_TESTS_MIGRATE = False
|
||||
|
||||
# if we run in managed mode, we need user support
|
||||
@@ -286,7 +305,7 @@ LOGGING = {
|
||||
},
|
||||
'formatters': {
|
||||
'datetime': {
|
||||
'format': 'DB %(asctime)s %(message)s'
|
||||
'format': '%(levelname)s %(asctime)s %(message)s'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
@@ -302,6 +321,10 @@ LOGGING = {
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'toaster' : {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
},
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
|
||||
Reference in New Issue
Block a user