use virtualenv's activate_this.py to reorder sys.path

This commit is contained in:
j 2009-08-21 17:30:31 +02:00
parent dfe3562d3e
commit 77f9d108d0

View file

@ -6,20 +6,13 @@ import site
project_module = 'oxdata' project_module = 'oxdata'
root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
site_package = os.path.normpath(os.path.join(root_dir, project_module, '..', 'env', 'lib', 'python2.5', 'site-packages'))
site.addsitedir(site_package) #using virtualenv's activate_this.py to reorder sys.path
activate_this = os.path.join(root_dir, 'env', 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
# add this django project
sys.path.append(root_dir) sys.path.append(root_dir)
sys.path.append(os.path.join(root_dir, project_module)) sys.path.append(os.path.join(root_dir, project_module))
sys.path.append(site_package)
#remove local folders
sys.path = filter(lambda x: "local" not in x, sys.path)
site.addsitedir(site_package)
#reload if this django.wsgi gets touched #reload if this django.wsgi gets touched
import monitor import monitor