mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 19:27:11 +00:00
tidy settigs PATHs
This commit is contained in:
@@ -81,7 +81,7 @@ def svxfilewild(request, year=None):
|
||||
def therionissues(request):
|
||||
"""Page displaying contents of a file produced during data import"""
|
||||
logname = "therionrefs.log"
|
||||
logpath = Path(settings.PYTHON_PATH, logname)
|
||||
logpath = settings.TROGGLE_PATH / logname
|
||||
therionlog = []
|
||||
newlog = []
|
||||
|
||||
@@ -106,7 +106,7 @@ def therionissues(request):
|
||||
def surveximport(request):
|
||||
"""Page displaying contents of a file produced during data import"""
|
||||
logname = "svxlinear.log"
|
||||
logpath = Path(settings.PYTHON_PATH, logname)
|
||||
logpath = settings.TROGGLE_PATH / logname
|
||||
|
||||
if Path(logpath).is_file:
|
||||
with open(logpath, "r") as f:
|
||||
@@ -119,7 +119,7 @@ def surveximport(request):
|
||||
def survexdebug(request):
|
||||
"""Page displaying contents of a file produced during data import"""
|
||||
logname = "svxblks.log"
|
||||
logpath = Path(settings.PYTHON_PATH, logname)
|
||||
logpath = settings.TROGGLE_PATH / logname
|
||||
|
||||
if Path(logpath).is_file:
|
||||
with open(logpath, "r") as f:
|
||||
@@ -138,31 +138,24 @@ def pathsreport(request):
|
||||
# "BOGUS" : str( settings.BOGUS),
|
||||
"JSLIB_URL": str(settings.JSLIB_URL),
|
||||
"JSLIB_ROOT": str(settings.JSLIB_ROOT),
|
||||
# "CSSLIB_URL" : str( settings.CSSLIB_URL),
|
||||
"CAVEDESCRIPTIONS": str(settings.CAVEDESCRIPTIONS),
|
||||
"DIR_ROOT": str(settings.DIR_ROOT),
|
||||
"ENTRANCEDESCRIPTIONS": str(settings.ENTRANCEDESCRIPTIONS),
|
||||
"EXPOUSER_EMAIL": str(settings.EXPOUSER_EMAIL),
|
||||
"EXPOUSERPASS": str("<redacted>"),
|
||||
"EXPOUSER": str(settings.EXPOUSER),
|
||||
"EXPOWEB": str(settings.EXPOWEB),
|
||||
# "EXPOWEB_URL": str(settings.EXPOWEB_URL),
|
||||
# "FILES" : str( settings.FILES),
|
||||
"LIBDIR": str(settings.LIBDIR),
|
||||
"LOGFILE": str(settings.LOGFILE),
|
||||
"LOGIN_REDIRECT_URL": str(settings.LOGIN_REDIRECT_URL),
|
||||
"MEDIA_ROOT": str(settings.MEDIA_ROOT),
|
||||
"MEDIA_URL": str(settings.MEDIA_URL),
|
||||
"PHOTOS_URL": str(settings.PHOTOS_URL),
|
||||
"PHOTOS_ROOT": str(settings.PHOTOS_ROOT),
|
||||
"PYTHON_PATH": str(settings.PYTHON_PATH),
|
||||
"REPOS_ROOT_PATH": str(settings.REPOS_ROOT_PATH),
|
||||
"TROGGLE_PATH": str(settings.TROGGLE_PATH),
|
||||
"ROOT_URLCONF": str(settings.ROOT_URLCONF),
|
||||
"STATIC_URL": str(settings.STATIC_URL),
|
||||
"SURVEX_DATA": str(settings.SURVEX_DATA),
|
||||
"SCANS_ROOT": str(settings.SCANS_ROOT),
|
||||
# "SURVEYS" : str( settings.SURVEYS),
|
||||
# "SCANS_URL" : str( settings.SCANS_URL),
|
||||
"SURVEXPORT": str(settings.SURVEXPORT),
|
||||
"DRAWINGS_DATA": str(settings.DRAWINGS_DATA),
|
||||
"URL_ROOT": str(settings.URL_ROOT),
|
||||
@@ -176,31 +169,24 @@ def pathsreport(request):
|
||||
# "BOGUS" : type(settings.BOGUS),
|
||||
"JSLIB_URL": type(settings.JSLIB_URL),
|
||||
"JSLIB_ROOT": type(settings.JSLIB_ROOT),
|
||||
# "CSSLIB_URL" : type(settings.CSSLIB_URL),
|
||||
"CAVEDESCRIPTIONS": type(settings.CAVEDESCRIPTIONS),
|
||||
"DIR_ROOT": type(settings.DIR_ROOT),
|
||||
"ENTRANCEDESCRIPTIONS": type(settings.ENTRANCEDESCRIPTIONS),
|
||||
"EXPOUSER_EMAIL": type(settings.EXPOUSER_EMAIL),
|
||||
"EXPOUSERPASS": type(settings.EXPOUSERPASS),
|
||||
"EXPOUSER": type(settings.EXPOUSER),
|
||||
"EXPOWEB": type(settings.EXPOWEB),
|
||||
# "EXPOWEB_URL": type(settings.EXPOWEB_URL),
|
||||
# "FILES" : type(settings.FILES),
|
||||
"LIBDIR": type(settings.LIBDIR),
|
||||
"LOGFILE": type(settings.LOGFILE),
|
||||
"LOGIN_REDIRECT_URL": type(settings.LOGIN_REDIRECT_URL),
|
||||
"MEDIA_ROOT": type(settings.MEDIA_ROOT),
|
||||
"MEDIA_URL": type(settings.MEDIA_URL),
|
||||
"PHOTOS_ROOT": type(settings.PHOTOS_ROOT),
|
||||
"PHOTOS_URL": type(settings.PHOTOS_URL),
|
||||
"PYTHON_PATH": type(settings.PYTHON_PATH),
|
||||
"REPOS_ROOT_PATH": type(settings.REPOS_ROOT_PATH),
|
||||
"TROGGLE_PATH": type(settings.TROGGLE_PATH),
|
||||
"ROOT_URLCONF": type(settings.ROOT_URLCONF),
|
||||
"STATIC_URL": type(settings.STATIC_URL),
|
||||
"SURVEX_DATA": type(settings.SURVEX_DATA),
|
||||
"SCANS_ROOT": type(settings.SCANS_ROOT),
|
||||
# "SURVEYS" : type(settings.SURVEYS),
|
||||
# "SCANS_URL" : type(settings.SCANS_URL),
|
||||
"SURVEXPORT": type(settings.SURVEXPORT),
|
||||
"DRAWINGS_DATA": type(settings.DRAWINGS_DATA),
|
||||
"URL_ROOT": type(settings.URL_ROOT),
|
||||
|
||||
@@ -22,7 +22,7 @@ troggle application.
|
||||
"""
|
||||
print(" - settings on loading databaseReset.py", flush=True)
|
||||
|
||||
os.environ["PYTHONPATH"] = str(settings.PYTHON_PATH)
|
||||
#os.environ["PYTHONPATH"] = str(settings.PYTHON_PATH)
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
||||
|
||||
print(" - settings on loading databaseReset.py")
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
import sys
|
||||
from pathlib 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
|
||||
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, or /javascript/ can be in
|
||||
a system-wide location rather than just a local directory.
|
||||
|
||||
This file is included at the end of the main troggle/settings.py file so that
|
||||
it overwrites defaults in that file.
|
||||
|
||||
Read https://realpython.com/python-pathlib/
|
||||
Read https://adamj.eu/tech/2020/03/16/use-pathlib-in-your-django-project/
|
||||
"""
|
||||
|
||||
print(" * importing troggle/localsettings.py")
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# THINK before you push this to a repo
|
||||
# - have you checked that credentials.py is in .gitignore ?
|
||||
# - we don't want to have to change the expo system password !
|
||||
# -----------------------------------------------------------------
|
||||
# default values, real secrets imported from credentials.py
|
||||
|
||||
SECRET_KEY = "real-SECRET_KEY--imported-from-localsettings.py"
|
||||
EXPOUSERPASS = "161:gosser" #- real-expo-password---imported-from-localsettings.py"
|
||||
EXPOADMINUSERPASS = "gosser:161" #- real-expo-password---imported-from-localsettings.py"
|
||||
EMAIL_HOST_PASSWORD = "real-email-password---imported-from-localsettings.py"
|
||||
|
||||
EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever. Tests are then less accurate.
|
||||
# SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely
|
||||
|
||||
SERVERPORT = "8000" # not needed
|
||||
|
||||
PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
|
||||
|
||||
# Troggle does a lot of file-handling. This is very error-prone when using primitive methods,
|
||||
# so we use pathlib which has been standard since python 3.4
|
||||
# If pathlib is new to you, you will need to read https://realpython.com/python-pathlib/
|
||||
|
||||
# --------------------- MEDIA redirections BEGIN ---------------------
|
||||
REPOS_ROOT_PATH = Path(__file__).parent.parent
|
||||
LIBDIR = REPOS_ROOT_PATH / "lib" / PV
|
||||
|
||||
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
|
||||
|
||||
EXPOFILES = REPOS_ROOT_PATH / "expofiles"
|
||||
|
||||
SCANS_ROOT = EXPOFILES / "surveyscans"
|
||||
PHOTOS_ROOT = EXPOFILES / "photos"
|
||||
PHOTOS_YEAR = "2024"
|
||||
# NOTABLECAVESHREFS = ["290", "291", "264", "258", "204", "359"] # moved to settings.py
|
||||
|
||||
|
||||
PYTHON_PATH = REPOS_ROOT_PATH / "troggle"
|
||||
LOGFILE = PYTHON_PATH / "troggle.log"
|
||||
SQLITEDB = PYTHON_PATH / "troggle.sqlite"
|
||||
KMZ_ICONS_PATH = PYTHON_PATH / "kmz_icons"
|
||||
|
||||
# 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/"
|
||||
|
||||
DIR_ROOT = Path("") # this should end in / if a value is given
|
||||
URL_ROOT = "/"
|
||||
# URL_ROOT = 'http://localhost:'+ SERVERPORT +'/'
|
||||
|
||||
# Note that these constants are not actually used in urls.py, they should be..
|
||||
# and they all need to end with / so using 'Path' doesn't work..
|
||||
MEDIA_URL = Path(URL_ROOT, "/site_media/")
|
||||
PHOTOS_URL = Path(URL_ROOT, "/photos/")
|
||||
|
||||
|
||||
STATIC_URL = Path(URL_ROOT, "/static/") # used by Django admin pages. Do not delete.
|
||||
JSLIB_URL = Path(URL_ROOT, "/javascript/") # used for CaveViewer JS utility
|
||||
|
||||
# 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 True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES !
|
||||
CACHEDPAGES = True # experimental page cache for a handful of page types
|
||||
DEVSERVER = True # running on WSL we are always a dev machine
|
||||
|
||||
DBSQLITE = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
"NAME": str(SQLITEDB),
|
||||
# 'NAME' : ':memory:',
|
||||
"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.
|
||||
}
|
||||
}
|
||||
DBMARIADB = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.mysql", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
"NAME": "troggle", # Or path to database file if using sqlite3.
|
||||
"USER": "expo",
|
||||
"PASSWORD": "my-secret-password-schwatzmooskogel",
|
||||
"HOST": "", # Set to empty string for localhost. Not used with sqlite3.
|
||||
"PORT": "", # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
|
||||
# default database for me is squlite
|
||||
DBSWITCH = "sqlite"
|
||||
|
||||
if DBSWITCH == "sqlite":
|
||||
DATABASES = DBSQLITE
|
||||
if DBSWITCH == "mariadb":
|
||||
DATABASES = DBMARIADB
|
||||
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [TEMPLATE_PATH],
|
||||
"OPTIONS": {
|
||||
"debug": "DEBUG",
|
||||
"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 - only used in expedition.html
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.i18n",
|
||||
"django.template.context_processors.media", # includes a variable MEDIA_URL
|
||||
"django.template.context_processors.static", # includes a variable STATIC_URL used by admin pages
|
||||
"django.template.context_processors.tz",
|
||||
"django.template.context_processors.request", # must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin navigation sidebar.
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
],
|
||||
"loaders": [
|
||||
"django.template.loaders.filesystem.Loader", # default lcation is troggle/templates/
|
||||
"django.template.loaders.app_directories.Loader", # needed for admin 'app'
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
EXPOUSER = "expo"
|
||||
EXPOUSER_EMAIL = "philip.sargent@gmail.com"
|
||||
EXPOADMINUSER = "expoadmin"
|
||||
EXPOADMINUSER_EMAIL = "philip.sargent@gmail.com"
|
||||
|
||||
EMAIL_HOST = "smtp-auth.mythic-beasts.com"
|
||||
EMAIL_HOST_USER = "django-test@klebos.net" # Philip Sargent really
|
||||
EMAIL_PORT = 587
|
||||
EMAIL_USE_TLS = True
|
||||
DEFAULT_FROM_EMAIL = "django-test@klebos.net"
|
||||
|
||||
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
|
||||
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
|
||||
EXPOWEB = REPOS_ROOT_PATH / "expoweb"
|
||||
CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
|
||||
ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
|
||||
|
||||
EXPOWEB_URL = ""
|
||||
# SCANS_URL = '/survey_scans/' # defunct, removed.
|
||||
|
||||
sys.path.append(str(REPOS_ROOT_PATH))
|
||||
sys.path.append(str(PYTHON_PATH))
|
||||
#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
|
||||
|
||||
# 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) + "/"
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
import sys
|
||||
from pathlib 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
|
||||
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, or /javascript/ can be in
|
||||
a system-wide location rather than just a local directory.
|
||||
|
||||
This file is included at the end of the main troggle/settings.py file so that
|
||||
it overwrites defaults in that file.
|
||||
|
||||
Read https://realpython.com/python-pathlib/
|
||||
Read https://adamj.eu/tech/2020/03/16/use-pathlib-in-your-django-project/
|
||||
"""
|
||||
|
||||
print(" * importing troggle/localsettings.py")
|
||||
|
||||
|
||||
EXPOUSER = 'expo'
|
||||
EXPOADMINUSER = 'expoadmin'
|
||||
EXPOUSER_EMAIL = 'wookey@wookware.org'
|
||||
EXPOADMINUSER_EMAIL = 'wookey@wookware.org'
|
||||
from secret_credentials import *
|
||||
|
||||
EMAIL_HOST = "smtp-auth.mythic-beasts.com"
|
||||
EMAIL_HOST_USER = "django-test@klebos.net" # Philip Sargent really
|
||||
EMAIL_PORT = 587
|
||||
EMAIL_USE_TLS = True
|
||||
DEFAULT_FROM_EMAIL = "django-test@klebos.net"
|
||||
# -----------------------------------------------------------------
|
||||
# THINK before you push this to a repo
|
||||
# - have you checked that secret_credentials.py is in .gitignore ?
|
||||
# - we don't want to have to change the expo system password !
|
||||
# -----------------------------------------------------------------
|
||||
# default values, real secrets will be imported from credentials.py in future
|
||||
|
||||
SQLITEFILE = "/home/philip/expo/troggle.sqlite" # can be ':memory:'
|
||||
|
||||
PHOTOSREMOTE = False # if True, then re-routes urls in expofiles/photos to remote server. Not implemented yet
|
||||
EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote server. Tests are then less accurate.
|
||||
# SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely
|
||||
SERVERPORT = "8000" # not needed as it is the default
|
||||
|
||||
ADMINS = (
|
||||
('Philip', 'philip.sargent@klebos.eu'),
|
||||
)
|
||||
|
||||
PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
|
||||
|
||||
# Troggle does a lot of file-handling. This is very error-prone when using primitive methods,
|
||||
# so we use pathlib which has been standard since python 3.4
|
||||
# If pathlib is new to you, you will need to read https://realpython.com/python-pathlib/
|
||||
|
||||
# --------------------- MEDIA redirections BEGIN ---------------------
|
||||
REPOS_ROOT_PATH = Path(__file__).parent.parent
|
||||
LIBDIR = REPOS_ROOT_PATH / "lib" / PV
|
||||
|
||||
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
|
||||
|
||||
# FILES = Path('/mnt/d/expofiles/')
|
||||
EXPOFILES = REPOS_ROOT_PATH / "expofiles"
|
||||
|
||||
SCANS_ROOT = EXPOFILES / "surveyscans"
|
||||
PHOTOS_ROOT = EXPOFILES / "photos"
|
||||
PHOTOS_YEAR = "2023"
|
||||
NOTABLECAVESHREFS = ["290", "291", "264", "258", "204", "359", "76", "107"]
|
||||
|
||||
|
||||
PYTHON_PATH = REPOS_ROOT_PATH / "troggle"
|
||||
LOGFILE = PYTHON_PATH / "troggle.log"
|
||||
|
||||
# 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/"
|
||||
|
||||
DIR_ROOT = Path("") # this should end in / if a value is given
|
||||
URL_ROOT = "/"
|
||||
# URL_ROOT = 'http://localhost:'+ SERVERPORT +'/'
|
||||
|
||||
# Note that these constants are not actually used in urls.py, they should be..
|
||||
# and they all need to end with / so using 'Path' doesn't work..
|
||||
MEDIA_URL = Path(URL_ROOT, "/site_media/")
|
||||
PHOTOS_URL = Path(URL_ROOT, "/photos/")
|
||||
|
||||
|
||||
STATIC_URL = Path(URL_ROOT, "/static/") # used by Django admin pages. Do not delete.
|
||||
JSLIB_URL = Path(URL_ROOT, "/javascript/") # used for CaveViewer JS utility
|
||||
|
||||
# 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 True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES !
|
||||
CACHEDPAGES = True # experimental page cache for a handful of page types
|
||||
|
||||
# executables:
|
||||
CAVERN = "cavern" # for parsing .svx files and producing .3d files
|
||||
SURVEXPORT = "survexport" # for parsing .3d files and producing .pos files
|
||||
|
||||
DBSQLITE = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
"NAME": SQLITEFILE,
|
||||
# 'NAME' : ':memory:',
|
||||
"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.
|
||||
}
|
||||
}
|
||||
DBMARIADB = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.mysql", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
"OPTIONS": {
|
||||
"charset": "utf8mb4",
|
||||
},
|
||||
"NAME": "troggle", # Or path to database file if using sqlite3.
|
||||
"USER": "expo",
|
||||
"PASSWORD": MARIADB_SERVER_PASSWORD,
|
||||
"HOST": "", # Set to empty string for localhost. Not used with sqlite3.
|
||||
"PORT": "", # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
|
||||
# default database for me is squlite
|
||||
DBSWITCH = "sqlite"
|
||||
|
||||
if DBSWITCH == "sqlite":
|
||||
DATABASES = DBSQLITE
|
||||
if DBSWITCH == "mariadb":
|
||||
DATABASES = DBMARIADB
|
||||
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [TEMPLATE_PATH],
|
||||
"OPTIONS": {
|
||||
"debug": "DEBUG",
|
||||
"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/context.py - only used in expedition.html
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.i18n",
|
||||
"django.template.context_processors.media", # includes a variable MEDIA_URL
|
||||
"django.template.context_processors.static", # includes a variable STATIC_URL used by admin pages
|
||||
"django.template.context_processors.tz",
|
||||
"django.template.context_processors.request", # must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin navigation sidebar.
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
],
|
||||
"loaders": [
|
||||
"django.template.loaders.filesystem.Loader", # default lcation is troggle/templates/
|
||||
"django.template.loaders.app_directories.Loader", # needed for admin 'app'
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
|
||||
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
|
||||
EXPOWEB = REPOS_ROOT_PATH / "expoweb"
|
||||
CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
|
||||
ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
|
||||
|
||||
# EXPOWEB_URL = "" # defunct, removed.
|
||||
# SCANS_URL = '/survey_scans/' # defunct, removed.
|
||||
|
||||
sys.path.append(str(REPOS_ROOT_PATH))
|
||||
sys.path.append(str(PYTHON_PATH))
|
||||
|
||||
# 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) + "/"
|
||||
|
||||
# Re-enable TinyMCE when Dj upgraded to v3. Also templates/editexpopage.html
|
||||
# TINYMCE_DEFAULT_CONFIG = {
|
||||
# 'plugins': "table,spellchecker,paste,searchreplace",
|
||||
# 'theme': "advanced",
|
||||
# }
|
||||
# TINYMCE_SPELLCHECKER = False
|
||||
# TINYMCE_COMPRESSOR = True
|
||||
#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
|
||||
|
||||
|
||||
# TEST_RUNNER = "django.test.runner.DiscoverRunner"
|
||||
|
||||
print(" + finished importing troggle/localsettings.py")
|
||||
@@ -19,14 +19,14 @@ if HOSTNAME == "expo":
|
||||
# print(">>>>running on expo.survex.com<<<<")
|
||||
DEVSERVER = False
|
||||
else:
|
||||
print(">>>>running on dev machine<<<<")
|
||||
print(f">>>>running on dev machine {HOSTNAME} <<<<")
|
||||
DEVSERVER = True
|
||||
|
||||
|
||||
EPOCH = date.fromisoformat('1970-01-01')
|
||||
|
||||
# default value, then gets overwritten by real secrets
|
||||
SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"
|
||||
# secrets are imported in localsettings.py from secret_credentials import *
|
||||
# SECRET_KEY =...
|
||||
|
||||
# executables:
|
||||
GIT = "git" # command for running git
|
||||
|
||||
Reference in New Issue
Block a user