import sys import os import site #import logging #add the site-packages of the chosen virtualenv site.addsitedir('/home/proxadmin/appserver/lib/python3.5/site-packages') #activate virtualenv #using libapache2-mod-wsgi: #activate_this = '/home/proxadmin/appserver/bin/activate_this.py' #execfile(activate_this, dict(__file__=activate_this)) #... or using libapache2-mod-wsgi-py3: activate_this = '/home/proxadmin/appserver/bin/activate_this.py' with open(activate_this) as file_: exec(file_.read(), dict(__file__=activate_this)) sys.path.append('/home/proxadmin/appserver/proxadmin') from app import app as application