os.environ['DJANGO_SETTINGS_MODULE'] = 'PROJECTNAME.settings'
sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'wsgi',
    'PROJECTNAME'))
virtenv = os.environ['APPDIR'] + '/virtenv/'
How to configure Django on OpenShift?