new self-adjusting paths

This commit is contained in:
Philip Sargent 2021-03-22 02:26:46 +00:00
parent 24bab23508
commit a0f504d1e2
2 changed files with 15 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import sys
import os
import urllib.parse
from unipath import Path
"""Settings for a troggle installation which may vary among different
installations: for development or deployment, in a docker image or
python virtual environment (venv), on ubuntu, debian or in Windows
@ -26,17 +27,21 @@ print(" * importing troggle/localsettings.py")
SERVERPORT = '8000'
LIBDIR = '/mnt/d/CUCC-Expo/t37/lib/python3.7/'
#LIBDIR = '/usr/lib/python3.8/'
# --------------------- MEDIA redirections BEGIN ---------------------
#REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/t37/'
REPOS_ROOT_PATH = Path(__file__).ancestor(1)
LIBDIR = REPOS_ROOT_PATH.child('lib').child('python3.7')
REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/t37/'
#REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/'
TROGGLE_PATH = Path(__file__)
TEMPLATE_PATH = TROGGLE_PATH.child('templates')
MEDIA_ROOT = TROGGLE_PATH.child('media')
MEDIA_ROOT = REPOS_ROOT_PATH + 'troggle/media/'
#MEDIA_URL = urllib.parse.urljoin(URL_ROOT , '/site_media/')
MEDIA_URL = '/site_media/'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
MEDIA_URL = '/site-media/'
#STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views_surveys.py
# --------------------- MEDIA redirections END ---------------------
PUBLIC_SITE = True
DEBUG = True # Always keep this, even when on public server. Otherwise NO ERROR MESSAGES !
@ -61,9 +66,9 @@ NOTABLECAVESHREFS = [ "264", "258", "204", "76", "107"]
sys.path.append(REPOS_ROOT_PATH)
sys.path.append(REPOS_ROOT_PATH + 'troggle')
PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
PYTHON_PATH = REPOS_ROOT_PATH.child('troggle')
LOGFILE = PYTHON_PATH + 'troggle.log'
LOGFILE = PYTHON_PATH.child(troggle.log')
TEMPLATES = [
{

View File

@ -109,7 +109,7 @@ SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"
LOGIN_REDIRECT_URL = '/'
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
#SESSION_COOKIE_SECURE = True # if enabled, cannot login to Django control panel
#SESSION_COOKIE_SECURE = True # if enabled, cannot login to Django control panel, bug elsewhere?
CSRF_COOKIE_SECURE = True
X_FRAME_OPTIONS = 'SAMEORIGIN' # change to "DENY" after we eliminate all the iframes e.g. /xmlvalid.html