Skip to content

Commit 09fef37

Browse files
committed
manage.py: prepend ./libraries-local to sys.path, allowing us to test any version of Django (after being copied there)
1 parent f77ebe8 commit 09fef37

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ pushreg
1212
mypoly.py
1313
tmp
1414
poly2.py
15+
libraries-local
1516

manage.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/usr/bin/env python
2+
3+
# Prepend project subdirectory 'libraries-local' to sys.path.
4+
# This allows us to use/test any version of Django
5+
# (e.g. Django 1.2 subversion) or any other packages/libraries.
6+
import sys, os
7+
project_path = os.path.dirname(os.path.abspath(__file__))
8+
libs_local_path = os.path.join(project_path, 'libraries-local')
9+
if libs_local_path not in sys.path: sys.path.insert(1, libs_local_path)
10+
import django
11+
print 'using Django version: %s, from %s' % (django.get_version(), os.path.dirname(os.path.abspath(django.__file__)))
12+
13+
# vanilla Django manage.py from here on:
14+
215
from django.core.management import execute_manager
316
try:
417
import settings # Assumed to be in the same directory.

0 commit comments

Comments
 (0)