Created
October 10, 2012 02:10
-
-
Save nveid/3862745 to your computer and use it in GitHub Desktop.
class2go.wsgi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
import site | |
# Remember original sys.path. | |
prev_sys_path = list(sys.path) | |
# we add currently directory to path and change to it | |
pwd = os.path.dirname(os.path.abspath(__file__)) | |
os.chdir(pwd) | |
sys.path = [pwd] + sys.path | |
# | |
# find the site-packages within the local virtualenv | |
for python_dir in os.listdir('lib'): | |
site_packages_dir = os.path.join('lib', python_dir, 'site-packages') | |
if os.path.exists(site_packages_dir): | |
site.addsitedir(os.path.abspath(site_packages_dir)) | |
# Reorder sys.path so new directories at the front. | |
new_sys_path = [] | |
for item in list(sys.path): | |
if item not in prev_sys_path: | |
new_sys_path.append(item) | |
sys.path.remove(item) | |
sys.path[:0] = new_sys_path | |
sys.path.append('/var/www/clients/client4/web102/class2go/main') | |
sys.path.append('/var/www/clients/client4/web102/class2go') | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | |
# now start django | |
from django.core.handlers.wsgi import WSGIHandler | |
application = WSGIHandler() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool, thanks for posting back. I'll put this in the core c2g but on this so when we get around to s/bitnami/ubuntu/g we can use this.