found_ve_path = expanded_path if not found_ve_path: raise Exception("Did not find a virtualenv in any of these directories: " + "%s" % searched_ve_paths) # not sure about this - might be required for packages installed from # git/svn etc # site.addsitedir(os.path.join(project_dir, 'django', project_name, '.ve', 'src')) # don't ever allow importing prefixed with 'project' # sys.path.append(os.path.join(project_dir, 'django')) sys.path.append(os.path.join(project_dir, "django", "intranet")) # this basically does: # os.environ['PROJECT_NAME_HOME'] = '/var/django/project_name/dev/' os.environ[project_name.upper() + "_HOME"] = project_dir # this does the same setup as "./manage.py runserver", ensuring we get the # same behaviour on apache as when developing. # See http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html # for the rationale. # Now we do the normal django set up. From Django 1.5 onwards: # https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.conf import settings from django.utils import translation translation.activate(settings.LANGUAGE_CODE)
sys.path.append(os.path.join(project_dir, 'deploy')) from project_settings import project_name, django_dir # ensure the virtualenv for this instance is added site.addsitedir(os.path.join(project_dir, django_dir, '.ve', 'lib', 'python2.6', 'site-packages')) # not sure about this - might be required for packages installed from # git/svn etc #site.addsitedir(os.path.join(project_dir, 'django', project_name, '.ve', 'src')) sys.path.append(os.path.join(project_dir, django_dir)) # this basically does: # os.environ['PROJECT_NAME_HOME'] = '/var/django/project_name/dev/' os.environ[project_name.upper() + '_HOME'] = project_dir # this does the same setup as "./manage.py runserver", ensuring we get the # same behaviour on apache as when developing. # See http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html # for the rationale. import settings import django.core.management # don't add the project directory to the environment, as this ends # up importing classes using the project name, and self.assertIsInstance # requires us to specify the project name, making our tests non-portable. # # sys.path.append(os.path.join(project_dir, 'django'))
if not found_ve_path: raise Exception("Did not find a virtualenv in any of these directories: " + "%s" % searched_ve_paths) # not sure about this - might be required for packages installed from # git/svn etc #site.addsitedir(os.path.join(project_dir, 'django', project_name, '.ve', 'src')) # don't ever allow importing prefixed with 'project' #sys.path.append(os.path.join(project_dir, 'django')) sys.path.append(os.path.join(project_dir, 'django', 'intranet')) # this basically does: # os.environ['PROJECT_NAME_HOME'] = '/var/django/project_name/dev/' os.environ[project_name.upper() + '_HOME'] = project_dir # this does the same setup as "./manage.py runserver", ensuring we get the # same behaviour on apache as when developing. # See http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html # for the rationale. # Now we do the normal django set up. From Django 1.5 onwards: # https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.conf import settings from django.utils import translation translation.activate(settings.LANGUAGE_CODE) try:
sys.path.append(os.path.join(project_dir, "deploy")) from project_settings import project_name # ensure the virtualenv for this instance is added site.addsitedir(os.path.join(project_dir, "django", project_name, ".ve", "lib", "python2.6", "site-packages")) # not sure about this - might be required for packages installed from # git/svn etc # site.addsitedir(os.path.join(project_dir, 'django', project_name, '.ve', 'src')) sys.path.append(os.path.join(project_dir, "django")) sys.path.append(os.path.join(project_dir, "django", project_name)) # print >> sys.stderr, sys.path os.environ["DJANGO_SETTINGS_MODULE"] = project_name + ".settings" # this basically does: # os.environ['PROJECT_NAME_HOME'] = '/var/django/project_name/dev/' os.environ[project_name.upper() + "_HOME"] = os.path.join("/var/django", project_name, "dev") import tika tika.initVM() import binder.monkeypatch import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()