From: Jordan Augé Date: Tue, 7 May 2013 08:39:09 +0000 (+0200) Subject: Merge branch 'jordan' of ssh://git.onelab.eu/git/myslice into jordan X-Git-Tag: myslice-0.2-1~130 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=544e6ac78d490061f848f98adb0e08574b474371;hp=f14a5114d0cf6673c172bdb89669fa80efcd3f2b Merge branch 'jordan' of ssh://git.onelab.eu/git/myslice into jordan --- diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index c0870eca..1826ba84 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -76,11 +76,11 @@ class ManifoldAPI: def send_manifold_query (self, query): # We use a dictionary representation of the query for forwarding it to the API ret = self.forward(query.to_dict()) - print "="*80 - print "Result:" - print ret - print "="*80 - print ret + if debug: + print "="*80 + print "Result:" + print ret + print "="*80 return ret #old# (action,subject)= (query.action,query.subject) 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'.