changeset 155:fa9e96198be5

sbin/sv: works independently of pwd
author Sylvain Beucler <beuc@beuc.net>
date Sat, 13 Mar 2010 22:18:17 +0100
parents 20584264d28c
children b8f224f37ddc
files savane/backend/__init__.py sbin/sv settings_default.py
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/savane/backend/__init__.py
+++ b/savane/backend/__init__.py
@@ -24,6 +24,9 @@
     Load python savane.backend submodule specified on the first
     argument of the command line
     """
+    if len(sys.argv) == 1:
+        print "Usage: %s command" % sys.argv[0]
+        sys.exit(1)
     command_name = sys.argv[1]
     (f, path, descr) = imp.find_module(command_name, __path__)
     imp.load_module(command_name, f, path, descr)
--- a/sbin/sv
+++ b/sbin/sv
@@ -24,8 +24,8 @@
 if not os.environ.has_key('DJANGO_SETTINGS_MODULE'):
     os.environ['DJANGO_SETTINGS_MODULE'] = 'settings';
 
-if os.path.exists('../savane'): # debug
-    sys.path.insert(0, '..')
+if os.path.exists(os.path.join(os.path.dirname(__file__), '../savane')): # debug
+    sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
 
 import savane.backend
 savane.backend.wrapper()
--- a/settings_default.py
+++ b/settings_default.py
@@ -63,12 +63,12 @@
     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
-    os.path.dirname(__file__) + '/templates',
+    os.path.join(os.path.dirname(__file__), 'templates'),
 )
 
 
 # Applications media
-STATIC_MEDIA_ROOT = os.path.dirname(__file__) + '/static_media/'
+STATIC_MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static_media/')
 STATIC_MEDIA_URL = '/static_media/'
 
 # Media for Django auto-admin