import sys, os # activate the virtualenv activate_this = '/home/www-data/swtstore/venv/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) BASE_DIR = os.path.join(os.path.dirname(__file__)) sys.path.insert(0, BASE_DIR) #import production_settings from swtstore import create_app application = create_app()