Permalink
Browse files

Added wsgi dispatcher

  • Loading branch information...
1 parent adadf37 commit 4c416be8777343aeba732098caadb114b0cd7662 @rosarior committed Mar 10, 2011
Showing with 22 additions and 0 deletions.
  1. +22 −0 wsgi/dispatch.wsgi
View
22 wsgi/dispatch.wsgi
@@ -0,0 +1,22 @@
+import os
+import sys
+import site
+
+sys.stdout = sys.stderr
+
+ve_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'lib/python2.6/site-packages'))
+# Add the virtual Python environment site-packages directory to the path
+site.addsitedir(ve_path)
+
+# put the Django project on sys.path
+sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
+sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
+sys.path.insert(0, ve_path)
+
+# Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages
+os.environ['PYTHON_EGG_CACHE'] = '/tmp'
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+
+from django.core.handlers.wsgi import WSGIHandler
+application = WSGIHandler()
+

0 comments on commit 4c416be

Please sign in to comment.