2020-06-20 17:19:50 +01:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import urllib.parse
|
2021-03-22 02:26:46 +00:00
|
|
|
from unipath import Path
|
2020-07-18 16:23:54 +01: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.
|
|
|
|
|
|
|
|
It sets the directory locations for the major parts of the system so
|
|
|
|
that e.g. expofiles can be on a different filesystem.
|
|
|
|
|
|
|
|
This file is included at the end of the main troggle/settings.py file so that
|
|
|
|
it overwrites defaults in that file.
|
|
|
|
"""
|
2020-06-20 17:19:50 +01:00
|
|
|
|
|
|
|
# link 'localsettings.py' to localsettingsWSL.py for use on a Windows 10 machine running WSL1
|
|
|
|
print(" * importing troggle/localsettings.py")
|
|
|
|
|
2020-06-24 01:57:20 +01:00
|
|
|
#-----------------------------------------------------------------
|
|
|
|
# THINK before you push this to a repo
|
|
|
|
# - have you checked that this file is in .gitignore ?
|
|
|
|
# - have you run pre-push.sh to copy files and remove passwords?
|
|
|
|
# - we don't want to have to change the expo system password !
|
|
|
|
#-----------------------------------------------------------------
|
|
|
|
|
2020-08-02 23:53:35 +01:00
|
|
|
SERVERPORT = '8000'
|
2020-06-20 17:19:50 +01:00
|
|
|
|
2021-03-22 02:26:46 +00:00
|
|
|
# --------------------- 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')
|
2020-06-20 17:19:50 +01:00
|
|
|
|
2021-03-22 02:26:46 +00:00
|
|
|
TROGGLE_PATH = Path(__file__)
|
|
|
|
TEMPLATE_PATH = TROGGLE_PATH.child('templates')
|
|
|
|
MEDIA_ROOT = TROGGLE_PATH.child('media')
|
2020-06-20 17:19:50 +01:00
|
|
|
|
2021-03-22 02:26:46 +00:00
|
|
|
# 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/'
|
2020-06-20 17:19:50 +01:00
|
|
|
|
|
|
|
#STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views_surveys.py
|
2021-03-22 02:26:46 +00:00
|
|
|
# --------------------- MEDIA redirections END ---------------------
|
2020-06-20 17:19:50 +01:00
|
|
|
|
2020-07-19 01:23:07 +01:00
|
|
|
PUBLIC_SITE = True
|
2020-08-02 23:53:35 +01:00
|
|
|
DEBUG = True # Always keep this, even when on public server. Otherwise NO ERROR MESSAGES !
|
2020-06-20 17:19:50 +01:00
|
|
|
|
|
|
|
# executables:
|
|
|
|
CAVERN = 'cavern'
|
2020-07-20 22:53:26 +01:00
|
|
|
THREEDTOPOS = 'survexport --pos'
|
2020-06-20 17:19:50 +01:00
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
|
|
|
'NAME' : 'troggle.sqlite',
|
2020-06-20 23:08:34 +01:00
|
|
|
# 'NAME' : ':memory:',
|
2020-06-20 17:19:50 +01:00
|
|
|
'USER' : 'expo', # Not used with sqlite3.
|
|
|
|
'PASSWORD' : 'sekrit', # Not used with sqlite3.
|
|
|
|
'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
|
|
|
|
'PORT' : '', # Set to empty string for default. Not used with sqlite3.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# add in 290, 291, 358 when they don't make it crash horribly
|
|
|
|
NOTABLECAVESHREFS = [ "264", "258", "204", "76", "107"]
|
|
|
|
|
|
|
|
sys.path.append(REPOS_ROOT_PATH)
|
|
|
|
sys.path.append(REPOS_ROOT_PATH + 'troggle')
|
2021-03-22 02:26:46 +00:00
|
|
|
PYTHON_PATH = REPOS_ROOT_PATH.child('troggle')
|
2020-06-20 17:19:50 +01:00
|
|
|
|
2021-03-22 02:26:46 +00:00
|
|
|
LOGFILE = PYTHON_PATH.child(troggle.log')
|
2020-06-20 17:19:50 +01:00
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
PYTHON_PATH + "templates"
|
|
|
|
],
|
|
|
|
'OPTIONS': {
|
|
|
|
'debug': 'DEBUG',
|
|
|
|
'context_processors': [
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
2020-06-20 23:08:34 +01:00
|
|
|
'core.context.troggle_context',
|
2020-06-20 17:19:50 +01:00
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.i18n',
|
|
|
|
'django.template.context_processors.media',
|
|
|
|
'django.template.context_processors.static',
|
|
|
|
'django.template.context_processors.tz',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
],
|
|
|
|
'loaders': [
|
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
# insert your TEMPLATE_LOADERS here
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
EXPOUSER = 'expo'
|
|
|
|
EXPOUSERPASS = "nnn:gggggg"
|
|
|
|
EXPOUSER_EMAIL = 'philip.sargent@gmail.com'
|
|
|
|
|
|
|
|
EMAIL_HOST = "smtp.gmail.com"
|
|
|
|
EMAIL_HOST_USER = "philip.sargent@gmail.com"
|
|
|
|
EMAIL_HOST_PASSWORD = "insert-real-email-password-here"
|
|
|
|
EMAIL_PORT=587
|
|
|
|
EMAIL_USE_TLS = True
|
|
|
|
|
|
|
|
SURVEX_DATA = REPOS_ROOT_PATH + 'loser/'
|
|
|
|
TUNNEL_DATA = REPOS_ROOT_PATH + 'drawings/'
|
|
|
|
THREEDCACHEDIR = REPOS_ROOT_PATH + 'expowebcache/3d/'
|
|
|
|
|
|
|
|
EXPOWEB = REPOS_ROOT_PATH + 'expoweb/'
|
|
|
|
SURVEYS = REPOS_ROOT_PATH
|
|
|
|
SURVEY_SCANS = '/mnt/f/expofiles/surveyscans/'
|
|
|
|
FILES = '/mnt/f/expofiles/'
|
|
|
|
CAVEDESCRIPTIONS = os.path.join(EXPOWEB, "cave_data")
|
|
|
|
ENTRANCEDESCRIPTIONS = os.path.join(EXPOWEB, "entrance_data")
|
|
|
|
EXPOWEB_URL = ''
|
|
|
|
SURVEYS_URL = '/survey_scans/'
|
|
|
|
EXPOFILES ='/mnt/f/expofiles/'
|
|
|
|
|
|
|
|
URL_ROOT = 'http://localhost:'+ SERVERPORT +'/'
|
|
|
|
DIR_ROOT = ''#this should end in / if a value is given
|
|
|
|
|
|
|
|
SURVEYS_URL = urllib.parse.urljoin(URL_ROOT , '/survey_scans/')
|
|
|
|
PHOTOS_URL = urllib.parse.urljoin(URL_ROOT , '/photos/')
|
2020-07-27 23:40:36 +01:00
|
|
|
SVX_URL = urllib.parse.urljoin(URL_ROOT , '/survex/')
|
2020-06-20 17:19:50 +01: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 ?
|
|
|
|
|
|
|
|
print(" + finished importing troggle/localsettings.py")
|