diff options
-rw-r--r-- | rpkid/portal-gui/rpki.wsgi.in | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/rpkid/portal-gui/rpki.wsgi.in b/rpkid/portal-gui/rpki.wsgi.in index eb49fe05..3d198349 100644 --- a/rpkid/portal-gui/rpki.wsgi.in +++ b/rpkid/portal-gui/rpki.wsgi.in @@ -25,16 +25,22 @@ import sys old_sys_path = list(sys.path) +def walk_error(e): + 'This function is invoked when os.walk() needs to report an error' + print >>sys.stderr, 'error reading %s: %s' % (e.filename, e) + # When used with virtualenv, specify the location of the python modules to use if VIRTUAL_ENV: - import site + d = os.path.join(VIRTUAL_ENV, 'lib') # locate the site-packages directory - for (dp, dn, fn) in os.walk(VIRTUAL_ENV + '/lib'): + for dp, dn, fn in os.walk(os.path.join(VIRTUAL_ENV, 'lib'), + onerror=walk_error): if 'site-packages' in dn: - site.addsitedir(os.path.join(dp, 'site-packages')) + d = os.path.join(dp, 'site-packages') + import site + site.addsitedir(d) break -import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' sys.path.insert(1, '@PYTHONPATH@') @@ -48,6 +54,8 @@ for elt in list(sys.path): sys.path.remove(elt) sys.path[:0] = new_sys_path +print >>sys.stderr, sys.path + import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() |