From 50f3f9251618c6a095bfb6188e43eea7b0acae48 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 7 May 2013 09:14:02 +0200 Subject: [PATCH 1/1] remove DEVELOPER_ROOT and PRODUCTION_ROOT, just guess ROOT from where this is installed --- myslice/settings.py | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) 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'. -- 2.45.2