summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-17 18:00:55 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2019-02-24 12:58:40 -0500
commit4e988e8a04d6f05529e4672c8b849d71911b3ed0 (patch)
tree39fac9af219738503ed36ea3c2f7e8b965321591
parentbb6b223537a40a0fa6fe09e3417575f38e236b21 (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"