[bitbake-devel] [PATCH 05/18] toaster: Start Django machinery for database access

brian avery avery.brian at gmail.com
Thu Dec 10 03:56:30 UTC 2015


From: Elliot Smith <elliot.smith at intel.com>

buildinfohelper, with the new import paths for our Django models
and Django 1.8, was not getting an active connection to the database.

In buildinfohelper, call django.setup() explicitly to make sure
that the database connection is ready and models can be queried
and saved.

[YOCTO #8364]

Signed-off-by: Elliot Smith <elliot.smith at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: brian avery <avery.brian at gmail.com>
---
 lib/bb/ui/buildinfohelper.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 87e03e7..04ce23a 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -24,6 +24,7 @@ import os
 os.environ["DJANGO_SETTINGS_MODULE"] = "toaster.toastermain.settings"
 
 
+import django
 from django.utils import timezone
 
 
@@ -33,6 +34,8 @@ def _configure_toaster():
     sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'toaster'))
 _configure_toaster()
 
+django.setup()
+
 from orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText
 from orm.models import Target_Image_File, BuildArtifact
 from orm.models import Variable, VariableHistory
-- 
1.9.1




More information about the bitbake-devel mailing list