Skip to content

Instantly share code, notes, and snippets.

@codeboy
Created May 30, 2012 09:16
Show Gist options
  • Save codeboy/2834916 to your computer and use it in GitHub Desktop.
Save codeboy/2834916 to your computer and use it in GitHub Desktop.
test
# -*- coding: utf-8 -*-
import os, sys, locale
import site, os
locale.setlocale(locale.LC_TIME,'ru_RU.utf8')
#projects_root = '/home/codeboy/xxx/svn2/'
#
#if projects_root not in sys.path:
# sys.path.append(projects_root)
#os.environ['DJANGO_SETTINGS_MODULE'] = 'unicom.settings'
##Запуск wsgi-обработчика
#import django.core.handlers.wsgi
#application = django.core.handlers.wsgi.WSGIHandler()
###########
vepath = '/home/codeboy/work/env2/lib/python2.7/site-packages'
prev_sys_path = list(sys.path)
# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)
# add the app's directory to the PYTHONPATH
sys.path.append('/home/codeboy/xxx/svn4-final-merge2/')
sys.path.append('/home/codeboy/xxx/svn4-final-merge2/unicom')
sys.path.append('/home/codeboy/xxx/svn4-final-merge2/unicom/private')
# reorder sys.path so new directories from the addsitedir show up first
new_sys_path = [p for p in sys.path if p not in prev_sys_path]
for item in new_sys_path:
sys.path.remove(item)
sys.path[:0] = new_sys_path
# import from down here to pull in possible virtualenv django install
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'unicom.settings'
application = WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment