manage.py: prepend ./libraries-local to sys.path, allowing us to test any version of Django (after being copied there)

fix_request_path_info
Bert Constantin 2010-01-24 16:17:18 +01:00
parent f77ebe8149
commit 09fef376ac
2 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View File

@ -12,4 +12,5 @@ pushreg
mypoly.py
tmp
poly2.py
libraries-local

View File

@ -1,4 +1,17 @@
#!/usr/bin/env python
# Prepend project subdirectory 'libraries-local' to sys.path.
# This allows us to use/test any version of Django
# (e.g. Django 1.2 subversion) or any other packages/libraries.
import sys, os
project_path = os.path.dirname(os.path.abspath(__file__))
libs_local_path = os.path.join(project_path, 'libraries-local')
if libs_local_path not in sys.path: sys.path.insert(1, libs_local_path)
import django
print 'using Django version: %s, from %s' % (django.get_version(), os.path.dirname(os.path.abspath(django.__file__)))
# vanilla Django manage.py from here on:
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.