浏览代码

[core] Force all DEBUG when django_debug_mode is True

Also fix a 500 when there is not fancy logger attached.
Romain Rigaux 9 年之前
父节点
当前提交
5b019c860d
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 4 0
      desktop/core/src/desktop/settings.py
  2. 1 1
      desktop/core/src/desktop/views.py

+ 4 - 0
desktop/core/src/desktop/settings.py

@@ -264,6 +264,10 @@ conf.initialize(_app_conf_modules, _config_dir)
 # Now that we've loaded the desktop conf, set the django DEBUG mode based on the conf.
 DEBUG = desktop.conf.DJANGO_DEBUG_MODE.get()
 TEMPLATE_DEBUG = DEBUG
+if DEBUG: # For simplification, force all DEBUG when django_debug_mode is True and re-apply the loggers
+  os.environ[ENV_DESKTOP_DEBUG] = 'True'
+  desktop.log.basic_logging(os.environ[ENV_HUE_PROCESS_NAME])
+  desktop.log.fancy_logging()
 
 ############################################################
 # Part 4a: Django configuration that requires bound Desktop

+ 1 - 1
desktop/core/src/desktop/views.py

@@ -103,7 +103,7 @@ def log_view(request):
     if isinstance(h, desktop.log.log_buffer.FixedBufferHandler):
       return render('logs.mako', request, dict(log=[l for l in h.buf], query=request.GET.get("q", "")))
 
-  return render('logs.mako', request, dict(log=[_("No logs found!")]))
+  return render('logs.mako', request, dict(log=[_("No logs found!")], query=''))
 
 @access_log_level(logging.WARN)
 def download_log_view(request):