mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 18:07:15 +00:00
tidied PATHs
This commit is contained in:
@@ -20,22 +20,42 @@ 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
|
||||
|
||||
EXPOUSER = 'expo'
|
||||
EXPOADMINUSER = 'expoadmin'
|
||||
EXPOUSER_EMAIL = 'wookey@wookware.org'
|
||||
EXPOADMINUSER_EMAIL = 'wookey@wookware.org'
|
||||
|
||||
from secret_credentials import *
|
||||
SECRET_KEY = "real-SECRET_KEY--imported-from-localsettings.py"
|
||||
SECRET_KEY = "real-SECRET_KEY--imported-from-localsettings.py"
|
||||
EXPOUSERPASS = "nnn:gggggg - real-expo-password---imported-from-localsettings.py"
|
||||
EXPOADMINUSERPASS = "gggggg:nnn - real-expo-password---imported-from-localsettings.py"
|
||||
EMAIL_HOST_PASSWORD = "real-email-password---imported-from-localsettings.py"
|
||||
# MARIADB_SERVER_PASSWORD =
|
||||
|
||||
EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever. Tests are then less accurate.
|
||||
EMAIL_HOST = "smtp-auth.mythic-beasts.com"
|
||||
EMAIL_HOST_USER = "django-test@klebos.eu" # Philip Sargent really
|
||||
EMAIL_PORT = 587
|
||||
EMAIL_USE_TLS = True
|
||||
DEFAULT_FROM_EMAIL = "EXPO SERVER AUTOMATIC <django-test@klebos.eu>"
|
||||
# -----------------------------------------------------------------
|
||||
# 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
|
||||
|
||||
SERVERPORT = "8000" # not needed
|
||||
ADMINS = (
|
||||
('Philip', 'philip.sargent@klebos.eu'), # only on dev
|
||||
)
|
||||
|
||||
PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
|
||||
|
||||
@@ -44,41 +64,30 @@ PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
|
||||
# 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
|
||||
REPOS_ROOT_PATH = Path(__file__).parent.parent # folder above troggle, expoweb, drawings, loser
|
||||
LIBDIR = REPOS_ROOT_PATH / "lib" / PV
|
||||
sys.path.append(str(REPOS_ROOT_PATH))
|
||||
|
||||
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"
|
||||
EXPOFILES = REPOS_ROOT_PATH / "expofiles" # sometimes on a different filesystem
|
||||
|
||||
SCANS_ROOT = EXPOFILES / "surveyscans"
|
||||
PHOTOS_ROOT = EXPOFILES / "photos"
|
||||
PHOTOS_YEAR = "2024"
|
||||
# NOTABLECAVESHREFS = ["290", "291", "264", "258", "204", "359"] # moved to settings.py
|
||||
PHOTOS_ROOT = EXPOFILES / "photos" # sometimes on a different filesystem
|
||||
PHOTOS_YEAR = "2025"
|
||||
|
||||
KMZ_ICONS_PATH = REPOS_ROOT_PATH / "troggle" / "kmz_icons" # Google Earth export in /caves/
|
||||
|
||||
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..
|
||||
# URL that handles the media served from MEDIA_ROOT.
|
||||
# Note that MEDIA_URL and PHOTOS_URL are not actually used in urls.py, they should be..
|
||||
# and they all need to end with / so using 'Path' doesn't work..
|
||||
URL_ROOT = "/"
|
||||
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
|
||||
|
||||
@@ -88,12 +97,11 @@ JSLIB_URL = Path(URL_ROOT, "/javascript/") # used for CaveViewer JS utility
|
||||
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": SQLITEFILE,
|
||||
# 'NAME' : ':memory:',
|
||||
"USER": "expo", # Not used with sqlite3.
|
||||
"PASSWORD": "sekrit", # Not used with sqlite3.
|
||||
@@ -104,9 +112,12 @@ DBSQLITE = {
|
||||
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": "my-secret-password-schwatzmooskogel",
|
||||
"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.
|
||||
}
|
||||
@@ -120,8 +131,6 @@ if DBSWITCH == "sqlite":
|
||||
if DBSWITCH == "mariadb":
|
||||
DATABASES = DBMARIADB
|
||||
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
@@ -131,7 +140,7 @@ TEMPLATES = [
|
||||
"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
|
||||
"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
|
||||
@@ -148,16 +157,7 @@ TEMPLATES = [
|
||||
},
|
||||
]
|
||||
|
||||
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"
|
||||
@@ -165,15 +165,18 @@ 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) + "/"
|
||||
|
||||
# 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
|
||||
|
||||
print(" + finished importing troggle/localsettings.py")
|
||||
@@ -52,17 +52,18 @@ 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"]
|
||||
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).
|
||||
@@ -87,15 +88,12 @@ JSLIB_URL = Path(URL_ROOT, "/javascript/") # used for CaveViewer JS utility
|
||||
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
|
||||
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": "/home/philip/expo/troggle.sqlite",
|
||||
"NAME": str(SQLITEDB),
|
||||
# 'NAME' : ':memory:',
|
||||
"USER": "expo", # Not used with sqlite3.
|
||||
"PASSWORD": "sekrit", # Not used with sqlite3.
|
||||
@@ -133,7 +131,7 @@ TEMPLATES = [
|
||||
"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
|
||||
"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
|
||||
@@ -167,7 +165,7 @@ EXPOWEB = REPOS_ROOT_PATH / "expoweb"
|
||||
CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
|
||||
ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
|
||||
|
||||
# EXPOWEB_URL = "" # defunct, removed.
|
||||
EXPOWEB_URL = ""
|
||||
# SCANS_URL = '/survey_scans/' # defunct, removed.
|
||||
|
||||
sys.path.append(str(REPOS_ROOT_PATH))
|
||||
|
||||
@@ -27,7 +27,6 @@ sudo apt autoremove -y
|
||||
|
||||
sudo apt install sqlite3 -y
|
||||
sudo apt install gedit -y
|
||||
sudo apt-get install imagemagick -y
|
||||
sudo apt install tig gitg meld -y
|
||||
|
||||
# python formatting https://docs.astral.sh/ruff/
|
||||
|
||||
Reference in New Issue
Block a user