2021-03-24 17:34:40 +00:00
|
|
|
import os
|
2023-01-19 20:47:26 +00:00
|
|
|
import sys
|
2021-03-24 17:34:40 +00:00
|
|
|
import urllib.parse
|
2022-06-22 18:17:33 +01:00
|
|
|
from pathlib import Path
|
2023-01-19 20:47:26 +00:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
"""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
|
|
|
|
System for Linux (WSL), on the main server or in the potato hut,
|
|
|
|
using SQLite or mariaDB.
|
2014-06-26 02:35:37 +01:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
It sets the directory locations for the major parts of the system so
|
2023-05-25 10:53:41 +01:00
|
|
|
that e.g. expofiles can be on a different filesystem.
|
2020-06-20 15:43:28 +01:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
This file is included at the end of the main troggle/settings.py file so that
|
|
|
|
it overwrites defaults in that file.
|
2022-06-22 18:17:33 +01:00
|
|
|
|
2023-05-25 10:53:41 +01:00
|
|
|
NOTE this file is vastly out of sync with troggle/_deploy/wsl/localsettings.py
|
|
|
|
which is the most recent version used in active maintenance. There should be
|
|
|
|
essential differences, but there and many, many non-essential differences which
|
|
|
|
should be eliminated for clarity and to use modern idioms. 8 March 2023.
|
2021-03-24 17:34:40 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
print(" * importing troggle/localsettings.py")
|
|
|
|
|
2022-06-22 18:17:33 +01:00
|
|
|
# DO NOT check this file into the git repo - it contains real passwords.
|
2021-05-12 22:00:39 +01:00
|
|
|
|
2022-06-22 18:17:33 +01:00
|
|
|
EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever
|
|
|
|
#SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely
|
2020-06-20 15:43:28 +01:00
|
|
|
|
2013-07-02 18:13:27 +01:00
|
|
|
DATABASES = {
|
2021-03-24 17:34:40 +00:00
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
|
|
|
'NAME' : 'troggle', # Or path to database file if using sqlite3.
|
|
|
|
'USER' : 'expo', # Not used with sqlite3.
|
2023-05-25 10:53:41 +01:00
|
|
|
'PASSWORD' : '123456789012345', # Not used with sqlite3. Not a real password.
|
2021-03-24 17:34:40 +00:00
|
|
|
'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
|
|
|
|
'PORT' : '', # Set to empty string for default. Not used with sqlite3.
|
2013-07-02 18:13:27 +01:00
|
|
|
}
|
|
|
|
}
|
2009-05-13 05:13:38 +01:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
|
2015-07-01 01:18:25 +01:00
|
|
|
EXPOUSER = 'expo'
|
2023-05-25 10:53:41 +01:00
|
|
|
EXPOUSERPASS = 'Not a real password'
|
2022-06-22 18:17:33 +01:00
|
|
|
EXPOADMINUSER = 'expoadmin'
|
2023-05-25 10:53:41 +01:00
|
|
|
EXPOADMINUSERPASS = 'Not a real password'
|
2015-07-01 01:18:25 +01:00
|
|
|
EXPOUSER_EMAIL = 'wookey@wookware.org'
|
2022-06-22 18:17:33 +01:00
|
|
|
EXPOADMINUSER_EMAIL = 'wookey@wookware.org'
|
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
REPOS_ROOT_PATH = '/home/expo/'
|
2011-07-14 03:50:49 +01:00
|
|
|
sys.path.append(REPOS_ROOT_PATH)
|
|
|
|
sys.path.append(REPOS_ROOT_PATH + 'troggle')
|
2021-03-24 17:34:40 +00:00
|
|
|
# Define the path to the django app (troggle in this case)
|
|
|
|
PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
|
2023-05-25 10:53:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
PHOTOS_YEAR = "2023"
|
|
|
|
# add in 358 when they don't make it crash horribly
|
|
|
|
NOTABLECAVESHREFS = [ "290", "291", "359", "264", "258", "204", "76", "107"]
|
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
PYTHON_PATH + "templates"
|
|
|
|
],
|
|
|
|
'OPTIONS': {
|
|
|
|
'debug': 'DEBUG',
|
2022-06-22 18:17:33 +01:00
|
|
|
'context_processors': [
|
|
|
|
# django.template.context_processors.csrf, # is always enabled and cannot be removed, sets csrf_token
|
|
|
|
'django.contrib.auth.context_processors.auth', # knowledge of logged-on user & permissions
|
|
|
|
'core.context.troggle_context', # in core/troggle.py
|
2021-03-24 17:34:40 +00:00
|
|
|
'django.template.context_processors.debug',
|
2022-06-22 18:17:33 +01:00
|
|
|
#'django.template.context_processors.request', # copy of current request, added in trying to make csrf work
|
2021-03-24 17:34:40 +00:00
|
|
|
'django.template.context_processors.i18n',
|
2022-06-22 18:17:33 +01:00
|
|
|
'django.template.context_processors.media', # includes a variable MEDIA_URL
|
|
|
|
'django.template.context_processors.static', # includes a variable STATIC_URL
|
2021-03-24 17:34:40 +00:00
|
|
|
'django.template.context_processors.tz',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
],
|
|
|
|
'loaders': [
|
|
|
|
'django.template.loaders.filesystem.Loader',
|
2022-06-22 18:17:33 +01:00
|
|
|
'django.template.loaders.app_directories.Loader', #For each app, inc admin, in INSTALLED_APPS, loader looks for /templates
|
|
|
|
# insert your own TEMPLATE_LOADERS here
|
2021-03-24 17:34:40 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
2011-07-14 03:50:49 +01:00
|
|
|
|
|
|
|
PUBLIC_SITE = True
|
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
# This should be False for normal running
|
2023-05-25 10:53:41 +01:00
|
|
|
DEBUG = False
|
2022-06-22 18:17:33 +01:00
|
|
|
CACHEDPAGES = True # experimental page cache for a handful of page types
|
2021-03-24 17:34:40 +00:00
|
|
|
|
2011-07-14 03:50:49 +01:00
|
|
|
|
2022-06-22 18:17:33 +01:00
|
|
|
# executables:
|
|
|
|
CAVERN = 'cavern' # for parsing .svx files and producing .3d files
|
|
|
|
SURVEXPORT = 'survexport' # for parsing .3d files and producing .pos files
|
|
|
|
|
2023-05-25 10:53:41 +01:00
|
|
|
PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
|
|
|
|
LIBDIR = Path(REPOS_ROOT_PATH) / 'lib' / PV
|
|
|
|
|
|
|
|
EXPOWEB = Path(REPOS_ROOT_PATH + 'expoweb/')
|
|
|
|
SURVEYS = REPOS_ROOT_PATH
|
|
|
|
SURVEY_SCANS = REPOS_ROOT_PATH + 'expofiles/surveyscans/'
|
2015-10-02 15:10:04 +01:00
|
|
|
FILES = REPOS_ROOT_PATH + 'expofiles'
|
2022-06-22 18:17:33 +01:00
|
|
|
PHOTOS_ROOT = REPOS_ROOT_PATH + 'expofiles/photos/'
|
|
|
|
|
|
|
|
TROGGLE_PATH = Path(__file__).parent
|
|
|
|
TEMPLATE_PATH = TROGGLE_PATH / 'templates'
|
|
|
|
MEDIA_ROOT = TROGGLE_PATH / 'media'
|
|
|
|
JSLIB_ROOT = TROGGLE_PATH / 'media' / 'jslib' # used for CaveViewer JS utility
|
|
|
|
|
|
|
|
|
2023-05-25 10:53:41 +01:00
|
|
|
CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
|
|
|
|
ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
|
2011-05-02 02:12:26 +01:00
|
|
|
|
2009-05-13 05:23:25 +01:00
|
|
|
|
2014-09-11 06:33:34 +01:00
|
|
|
PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
|
2009-05-13 05:17:50 +01:00
|
|
|
|
2023-05-25 10:53:41 +01:00
|
|
|
|
2022-06-22 18:17:33 +01:00
|
|
|
#URL_ROOT = 'http://expo.survex.com/'
|
|
|
|
URL_ROOT = '/'
|
2023-05-25 10:53:41 +01:00
|
|
|
DIR_ROOT = Path("") #this should end in / if a value is given
|
2021-03-24 17:34:40 +00:00
|
|
|
EXPOWEB_URL = '/'
|
2023-05-25 10:53:41 +01:00
|
|
|
SURVEYS_URL = '/survey_scans/'
|
|
|
|
|
|
|
|
REPOS_ROOT_PATH = Path(REPOS_ROOT_PATH)
|
|
|
|
|
|
|
|
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
|
|
|
|
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
|
|
|
|
|
|
|
|
|
|
|
|
EXPOFILES = REPOS_ROOT_PATH / "expofiles"
|
|
|
|
SCANS_ROOT = EXPOFILES / "surveyscans"
|
|
|
|
PHOTOS_ROOT = EXPOFILES / "photos"
|
|
|
|
|
|
|
|
#EXPOFILES = urllib.parse.urljoin(REPOS_ROOT_PATH, 'expofiles/')
|
2021-03-24 17:34:40 +00:00
|
|
|
PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/')
|
2009-05-13 05:23:37 +01:00
|
|
|
|
2022-06-22 18:17:33 +01:00
|
|
|
# MEDIA_URL is used by urls.py in a regex. See urls.py & core/views_surveys.py
|
2021-03-24 17:34:40 +00:00
|
|
|
MEDIA_URL = '/site_media/'
|
2018-04-15 16:36:23 +01:00
|
|
|
|
2011-05-01 19:58:38 +01:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
STATIC_URL = urllib.parse.urljoin(URL_ROOT , '/static/') # used by Django admin pages. Do not delete.
|
|
|
|
JSLIB_URL = urllib.parse.urljoin(URL_ROOT , '/javascript/') # always fails, try to revive it ?
|
2023-05-25 10:53:41 +01:00
|
|
|
# STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
|
2009-09-14 23:09:50 +01:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
#TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' # not needed while TinyMCE not installed
|
|
|
|
#TINY_MCE_MEDIA_URL = STATIC_URL + '/tiny_mce/' # not needed while TinyMCE not installed
|
2009-09-14 23:09:50 +01:00
|
|
|
|
2021-03-24 17:34:40 +00:00
|
|
|
LOGFILE = '/var/log/troggle/troggle.log'
|
|
|
|
IMPORTLOGFILE = '/var/log/troggle/import.log'
|
2009-09-14 23:09:50 +01:00
|
|
|
|
2023-05-25 10:53:41 +01:00
|
|
|
# Sanitise these to be strings as Django seems to be particularly sensitive to crashing if they aren't
|
|
|
|
STATIC_URL = str(STATIC_URL) + "/"
|
|
|
|
MEDIA_URL = str(MEDIA_URL) + "/"
|
2022-06-22 18:17:33 +01:00
|
|
|
|
2023-05-25 10:53:41 +01:00
|
|
|
print(" + finished importing troggle/localsettings.py")
|