diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-02-07 20:14:06 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-02-07 20:14:06 +0000 |
commit | 354779d487dbeb03fa4668093591547fc927e5ad (patch) | |
tree | 696fbfd1212b0a258dc02c8fb0be0f878e1ab360 /rpkid/portal-gui | |
parent | 9541365959d9b5c1cb2ee94f7cb9fc96eb3aaf14 (diff) |
make configure detect when running inside of virtualenv so that the rpki.wsgi script can be generated properly
make rpki.wsgi be generated used a sed script rather than make-django-script
svn path=/branches/tk161/; revision=4312
Diffstat (limited to 'rpkid/portal-gui')
-rw-r--r-- | rpkid/portal-gui/rpki.wsgi.in | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/rpkid/portal-gui/rpki.wsgi.in b/rpkid/portal-gui/rpki.wsgi.in index e4471d11..5dd5a7e3 100644 --- a/rpkid/portal-gui/rpki.wsgi.in +++ b/rpkid/portal-gui/rpki.wsgi.in @@ -17,20 +17,23 @@ __version__ = '$Id$' -#prev_sys_path = list(sys.path) +VIRTUAL_ENV = '@VIRTUAL_ENV@' -# When used with virtualenv, specify the location of the python modules to use -import site -site.addsitedir('/home/melkins/web_portal/lib/python2.6/site-packages') - -#new_sys_path = [] -#for item in list(sys.path): -# if item not in prev_sys_path: -# new_sys_path.append(item) -# sys.path.remove(item) -#sys.path[:0] = new_sys_path +import os +import os.path -#print sys.path +# When used with virtualenv, specify the location of the python modules to use +if VIRTUAL_ENV: + import site + # locate the site-packages directory + for (dp, dn, fn) in os.walk(VIRTUAL_ENV + '/lib'): + if 'site-packages' in dn: + site.addsitedir(os.path.join(dp, 'site-packages')) + break + +import sys +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' +sys.path.insert(1, '@PYTHONPATH@') import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() |