]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: skip virtualenv when searching for django apps
authorMichael Wood <michael.g.wood@intel.com>
Mon, 27 Oct 2014 19:03:06 +0000 (19:03 +0000)
committerAlexandru DAMIAN <alexandru.damian@intel.com>
Thu, 20 Nov 2014 15:43:57 +0000 (15:43 +0000)
If we are using a virtualenv in the current search path we end up trying
to add modules to the django apps list which do not have the correct
load path or are internal to other modules. Fix this by skipping the
virtualenv path.

[YOCTO #6896]

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
lib/toaster/toastermain/settings.py
lib/toaster/toastermain/urls.py

index 8de3b52f346c8102d5a85153747d9123bc2b08ac..0974b905258ec77bbe8efa87f76778dad5491b1c 100644 (file)
@@ -264,6 +264,10 @@ import os
 currentdir = os.path.dirname(__file__)
 for t in os.walk(os.path.dirname(currentdir)):
     modulename = os.path.basename(t[0])
+    #if we have a virtualenv skip it to avoid incorrect imports
+    if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]:
+        continue
+
     if ("views.py" in t[2] or "models.py" in t[2]) and not modulename in INSTALLED_APPS:
         INSTALLED_APPS = INSTALLED_APPS + (modulename,)
 
index 1ae6245cc385547c6653ba5c8bc949e36a205869..549fda12d6706abacbcf76617a30c75e3c6ca970 100644 (file)
@@ -55,6 +55,10 @@ if toastermain.settings.MANAGED:
 import os
 currentdir = os.path.dirname(__file__)
 for t in os.walk(os.path.dirname(currentdir)):
+    #if we have a virtualenv skip it to avoid incorrect imports
+    if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]:
+        continue
+
     if "urls.py" in t[2] and t[0] != currentdir:
         modulename = os.path.basename(t[0])
         urlpatterns.append( url(r'^' + modulename + '/', include ( modulename + '.urls')))