From 77c7261f1f8173f8dcb0e30769fb553ac8bfb30c Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Fri, 11 Nov 2011 01:20:44 +0000 Subject: prepend ${sysconfdir}/rpki to sys.path to avoid picking up the wrong settings.py by accident svn path=/branches/tk103/; revision=4082 --- buildtools/make-django-script.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'buildtools') diff --git a/buildtools/make-django-script.py b/buildtools/make-django-script.py index 67dd8ed3..c8b3ef68 100644 --- a/buildtools/make-django-script.py +++ b/buildtools/make-django-script.py @@ -1,7 +1,5 @@ """ -Convert a Python script into an executable Python script. Mostly this -means constructing a header based on a few parameters supplied by -autoconf. +Prepend boilerplate required for scripts which make use of Django's ORM. $Id$ @@ -27,7 +25,9 @@ sys.stdout.write('''\ # Automatically constructed script header import sys, os -sys.path.append('%(AC_PYTHONPATH)s') +# sys.path[0] is the cwd of the script being executed, so we add the +# path to the settings.py file after it +sys.path.insert(1, '%(AC_PYTHONPATH)s') os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' # Original script starts here -- cgit v1.2.3