From 6f540a0e3f50b439c166ddc77071b6f43241afc0 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Fri, 2 Dec 2016 22:17:42 -0500 Subject: [PATCH] Remove hardcoded references to /var/www. This makes it easier to run the code elsewhere, like a development environment. --- www/conservancy/settings.py | 17 ++++++++--------- www/wsgicustom.wsgi | 3 ++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/www/conservancy/settings.py b/www/conservancy/settings.py index 68e506a0..1edd532c 100644 --- a/www/conservancy/settings.py +++ b/www/conservancy/settings.py @@ -17,6 +17,8 @@ # along with this program in a file in the toplevel directory called # "AGPLv3". If not, see . +import os.path + from djangocommonsettings import * SITE_ID = 2 @@ -31,15 +33,12 @@ REDIRECT_TABLE = { 'www.sf-conservancy.org': 'sfconservancy.org', } -# import os -# BASE_DIR = os.path.dirname(os.path.dirname(__file__)) - -# from os.path import join -# TEMPLATE_DIRS = ( -# join(BASE_DIR, 'templates'), -# ) -# NOTE: trailing comma is required to force this to be a tuple -TEMPLATE_DIRS = ( '/var/www/conservancy/templates', '/var/www/conservancy/static', ) +_root_dir = os.path.abspath(os.path.dirname(__file__)) +TEMPLATE_DIRS = ( + os.path.join(_root_dir, 'templates'), + os.path.join(_root_dir, 'static'), +) +del _root_dir # try: # from djangodebug import conservancy_hostname as FORCE_CANONICAL_HOSTNAME diff --git a/www/wsgicustom.wsgi b/www/wsgicustom.wsgi index fa1197c3..d06f0061 100644 --- a/www/wsgicustom.wsgi +++ b/www/wsgicustom.wsgi @@ -3,7 +3,8 @@ import os import sys -sys.path = ['/var/www'] + sys.path +root_dir = os.path.abspath(os.path.dirname(__file__)) +sys.path.insert(0, root_dir) os.environ['DJANGO_SETTINGS_MODULE'] = 'conservancy.settings' from django.core.wsgi import get_wsgi_application