From f0a4bb57d554387ad5d803bc1c00f16a2e2b371b Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 27 Nov 2013 08:13:11 +0100 Subject: [PATCH] oops, settings.py was broken for when running collectstatic at build-time --- myslice/settings.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/myslice/settings.py b/myslice/settings.py index 91584419..4df98e2e 100644 --- a/myslice/settings.py +++ b/myslice/settings.py @@ -14,20 +14,22 @@ try: # move one step up ROOT=os.path.realpath(ROOT+'/..') except: + # something is badly wrong here ROOT=None - if DEBUG: - import traceback - traceback.print_exc() - -if os.path.isdir(os.path.join(ROOT,"static")): + import traceback + traceback.print_exc() + +# find out DATAROOT, which is different from ROOT +# when deployed from a package +# this code is run by collectstatic too, so we cannot +# assume we have ./static present already +DATAROOT="/usr/share/unfold" +# if not there, then we assume it's from a devel tree +if not os.path.isdir (os.path.join(DATAROOT,"static")): DATAROOT=ROOT -else: - DATAROOT="/usr/share/unfold" - if not os.path.isdir(os.path.join(DATAROOT,"static")): - DATAROOT=None -if not ROOT: raise Exception,"Cannot find ROOT for myslice" -if not DATAROOT: raise Exception,"Cannot find DATAROOT for myslice" +if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for myslice"%ROOT +if not os.path.isdir(DATAROOT): raise Exception,"Cannot find DATAROOT %s for myslice"%DATAROOT #################### ADMINS = ( -- 2.43.0