X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=myslice%2Fsettings.py;h=2dbb8618cead965936ad73a64a693a3ccf1f0272;hb=50f3f9251618c6a095bfb6188e43eea7b0acae48;hp=e5319f479b0e9f66276ad17ab7a9a626aee39db5;hpb=5f74cb3f960c342b56f91d772061900ac48528ea;p=unfold.git diff --git a/myslice/settings.py b/myslice/settings.py index e5319f47..2dbb8618 100644 --- a/myslice/settings.py +++ b/myslice/settings.py @@ -5,11 +5,22 @@ import os.path DEBUG = True TEMPLATE_DEBUG = DEBUG -# change these if you use a different convention - -DEVELOPER_ROOT=os.path.expanduser("~/repos/myslice-django") - -PRODUCTION_ROOT="/usr/share/myslice/USE_DEVELOPMENT" +# compute ROOT from where this file is installed +# should fit every need including developers +# but you can redefine ROOT if that's not working for you +try: + # get the directory where this file is + ROOT=os.path.dirname(__file__) or '.' + # move one step up + ROOT=os.path.realpath(ROOT+'/..') +except: + ROOT=None + if DEBUG: + import traceback + traceback.print_exc() + +if not ROOT: + raise Exception,"Cannot find ROOT for myslice" #################### ADMINS = ( @@ -18,22 +29,6 @@ ADMINS = ( MANAGERS = ADMINS -#################### -# guess if we run on the 'prod' site (:) that for now uses /root/myslice and run manage.py -# or on a working laptop, in which case we use ~/git/myslice-django -import os, os.path -ROOT='' -def init_root (): - global ROOT - if os.path.exists(PRODUCTION_ROOT): - ROOT=PRODUCTION_ROOT - elif os.path.exists (DEVELOPER_ROOT): - ROOT=DEVELOPER_ROOT - else: - raise Exception,"Cannot find ROOT for myslice (neither %s nor %s)"%(PRODUCTION_ROOT,DEVELOPER_ROOT) - -init_root() - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.