diff options
-rw-r--r-- | rpkid/portal-gui/rpki.wsgi.in | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rpkid/portal-gui/rpki.wsgi.in b/rpkid/portal-gui/rpki.wsgi.in index 5dd5a7e3..eb49fe05 100644 --- a/rpkid/portal-gui/rpki.wsgi.in +++ b/rpkid/portal-gui/rpki.wsgi.in @@ -21,6 +21,9 @@ VIRTUAL_ENV = '@VIRTUAL_ENV@' import os import os.path +import sys + +old_sys_path = list(sys.path) # When used with virtualenv, specify the location of the python modules to use if VIRTUAL_ENV: @@ -35,6 +38,16 @@ import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' sys.path.insert(1, '@PYTHONPATH@') +# reorder sys.path to place newly added directories at the head of the path. +# this is necessary so that the packages in the virtualenv site-packages are +# used rather than the system site-packages. +new_sys_path = [] +for elt in list(sys.path): + if elt not in old_sys_path: + new_sys_path.append(elt) + sys.path.remove(elt) +sys.path[:0] = new_sys_path + import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() |