From: Thierry Parmentelat Date: Wed, 27 Nov 2013 07:13:11 +0000 (+0100) Subject: oops, settings.py was broken for when running collectstatic at build-time X-Git-Tag: myslice-0.3-0~107^2 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=f0a4bb57d554387ad5d803bc1c00f16a2e2b371b oops, settings.py was broken for when running collectstatic at build-time --- 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 = (