Permalink
Browse files

Various changes to make imports work

  • Loading branch information...
1 parent 1ff5677 commit 879391b205a117394d72d737daa5e3b1ea6f0cc8 @bdarnell committed Feb 23, 2011
Showing with 22 additions and 0 deletions.
  1. 0 chat/__init__.py
  2. +21 −0 sitecustomize.py
  3. +1 −0 third_party/tornado.pth
View
0 chat/__init__.py
No changes.
View
21 sitecustomize.py
@@ -0,0 +1,21 @@
+import os
+import site
+import sys
+
+base_dir = os.path.dirname(os.path.abspath(__file__))
+
+prev_sys_path = list(sys.path)
+
+# site.addsitedir adds this directory to sys.path then scans for .pth files
+# and adds them to the path too.
+site.addsitedir(os.path.join(base_dir, 'third_party'))
+
+# addsitedir adds its directories at the end, but we want our local stuff
+# to take precedence over system-installed packages.
+# See http://code.google.com/p/modwsgi/issues/detail?id=112
+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
View
1 third_party/tornado.pth
@@ -0,0 +1 @@
+tornado

0 comments on commit 879391b

Please sign in to comment.