Permalink
Browse files

Amended wsgi file to load the directories directly

  • Loading branch information...
alfredo committed Mar 6, 2012
1 parent 500af1d commit b0cf0b6cadbd268fd94102d74da71d38d0cf5b8b
Showing with 21 additions and 5 deletions.
  1. +21 −5 wsgi/phase2.wsgi
View
@@ -6,14 +6,30 @@ os.environ['CELERY_LOADER'] = 'django'
# Add the app dir to the python path so we can import manage.
wsgidir = os.path.dirname(__file__)
-site.addsitedir(os.path.abspath(os.path.join(wsgidir, '..')))
-site.addsitedir(os.path.abspath(os.path.join(wsgidir, '..', '..')))
-site.addsitedir('/var/webapps/ignite-phase2/venv/lib/python2.6/site-packages/')
+path = lambda *x: os.path.join(os.path.dirname(
+ os.path.realpath(__file__)), '..', *x)
+
+site.addsitedir(path('.'))
+site.addsitedir(path('..'))
# manage adds /apps, /lib, and /vendor to the Python path.
-import manage
-os.environ['DJANGO_SETTINGS_MODULE'] = 'ignite-phase2.settings_local'
+# replicated from manage.py
+
+# Adjust the python path and put local packages in front.
+prev_sys_path = list(sys.path)
+site.addsitedir(path('apps'))
+site.addsitedir(path('lib'))
+
+# Local (project) vendor library
+site.addsitedir(path('vendor-local'))
+site.addsitedir(path('vendor-local/lib/python'))
+
+# Global (upstream) vendor library
+site.addsitedir(path('vendor'))
+site.addsitedir(path('vendor/lib/python'))
+
+os.environ['DJANGO_SETTINGS_MODULE'] = 'ignite_phase2.settings_local'
os.environ['DJANGO_SITE'] = 'ignite'
import django.core.handlers.wsgi

0 comments on commit b0cf0b6

Please sign in to comment.