From c730d43dbf150a3926cf58ddafe7500940876e43 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Fri, 10 May 2013 09:18:37 -0400 Subject: [PATCH] Resolved import conflict involving django-staticfiles (lettuce assumes we are using django.contrib.staticfiles). This allows us to run the django-admin.py harvest test server, instead of launching the server ourselves. --- common/djangoapps/terrain/browser.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 1d371a3242..b52ae2b712 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -9,6 +9,21 @@ from django.conf import settings from lms import one_time_startup from cms import one_time_startup +# There is an import issue when using django-staticfiles with lettuce +# Lettuce assumes that we are using django.contrib.staticfiles, +# but the rest of the app assumes we are using django-staticfiles +# (in particular, django-pipeline and our mako implementation) +# To resolve this, we check whether staticfiles is installed, +# then redirect imports for django.contrib.staticfiles +# to use staticfiles. +try: + import staticfiles +except ImportError: + pass +else: + import sys + sys.modules['django.contrib.staticfiles'] = staticfiles + logger = getLogger(__name__) logger.info("Loading the lettuce acceptance testing terrain file...")