diff options
author | Michael Elkins <melkins@tislabs.com> | 2011-11-11 01:20:44 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2011-11-11 01:20:44 +0000 |
commit | 77c7261f1f8173f8dcb0e30769fb553ac8bfb30c (patch) | |
tree | 142f7d96862a3cce86552da1013c21d609dadd58 /buildtools/make-django-script.py | |
parent | 82cdb46860033738cff0ebc77ea6af75fd66fbb5 (diff) |
prepend ${sysconfdir}/rpki to sys.path to avoid picking up the wrong settings.py by accident
svn path=/branches/tk103/; revision=4082
Diffstat (limited to 'buildtools/make-django-script.py')
-rw-r--r-- | buildtools/make-django-script.py | 8 |
1 files changed, 4 insertions, 4 deletions
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 |