summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-17 18:00:55 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-17 18:00:55 -0400
commit1bb1b8f9ad4ea8b8ac64ecee417db960771318b2 (patch)
treedf8bcfc6d4cc17a972a7f3422f93cca1b5326cb9
parentf4f158c3868c1770cb7d4f800881803e7250c27b (diff)
archweb.wsgi: try to detect the location automatically
-rw-r--r--archweb.wsgi8
1 files changed, 5 insertions, 3 deletions
diff --git a/archweb.wsgi b/archweb.wsgi
index a0d969e7..20ec463e 100644
--- a/archweb.wsgi
+++ b/archweb.wsgi
@@ -3,10 +3,12 @@ import os
import sys
import site
-base_path = "/srv/http/archweb"
+base_path = os.path.dirname(os.path.realpath(__file__))
-site.addsitedir('/srv/http/archweb-env/lib/python2.7/site-packages')
-sys.path.insert(0, base_path)
+virtualenv_path = os.path.join(base_path, "env")
+if os.path.isdir(virtualenv_path):
+ site.addsitedir(os.path.join(virtualenv_path, 'lib/python2.7/site-packages'))
+ sys.path.insert(0, base_path)
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"