summaryrefslogtreecommitdiffstats
path: root/_deploy
diff options
context:
space:
mode:
Diffstat (limited to '_deploy')
-rw-r--r--_deploy/debian-laptops/localsettings2023-04-05-cleansed.py160
-rw-r--r--_deploy/debian-laptops/localsettings2023-04-05-secret.py160
-rw-r--r--_deploy/debian-laptops/localsettingsserver2023-01-cleansed.py164
-rw-r--r--_deploy/debian-laptops/os-trog.sh70
-rw-r--r--_deploy/debian-laptops/settings2023-02-10.py (renamed from _deploy/debian/settings.py)0
-rw-r--r--_deploy/debian-laptops/settings2023-04-23.py147
-rw-r--r--_deploy/debian-laptops/venv-trog-crowley.sh173
-rw-r--r--_deploy/debian-server/apache2.conf (renamed from _deploy/debian/apache2.conf)0
-rw-r--r--_deploy/debian-server/envvars (renamed from _deploy/debian/envvars)0
-rw-r--r--_deploy/debian-server/localsettingsserver-old.py (renamed from _deploy/debian/localsettingsserver-old.py)0
-rw-r--r--_deploy/debian-server/localsettingsserver2023-01-secret.py (renamed from _deploy/debian/localsettingsserver.py)0
-rw-r--r--_deploy/debian-server/requirements-server.txt23
-rw-r--r--_deploy/debian-server/serversetup (renamed from _deploy/debian/serversetup)0
-rw-r--r--_deploy/debian-server/sitecustomize.py (renamed from _deploy/debian/sitecustomize.py)0
-rw-r--r--_deploy/debian-server/this-is-the-live-expo.survex.com-system.txt (renamed from _deploy/debian/this-is-the-live-expo.survex.com-system.txt)0
-rw-r--r--_deploy/debian-server/wookey-exposerver-recipe.txt (renamed from _deploy/debian/wookey-exposerver-recipe.txt)0
-rw-r--r--_deploy/potatohut/localsettingspotatohut.py79
-rw-r--r--_deploy/readme.txt18
-rw-r--r--_deploy/ubuntu-dev/localsettingsubuntu.py (renamed from _deploy/ubuntu/localsettingsubuntu.py)0
-rw-r--r--_deploy/wsl/localsettingsWSL.py7
-rw-r--r--_deploy/wsl/requirements-devupgrade.txt20
-rw-r--r--_deploy/wsl/venv-trog.sh171
-rw-r--r--_deploy/xubuntu/pre-push-barbie.sh46
23 files changed, 1156 insertions, 82 deletions
diff --git a/_deploy/debian-laptops/localsettings2023-04-05-cleansed.py b/_deploy/debian-laptops/localsettings2023-04-05-cleansed.py
new file mode 100644
index 0000000..2544dff
--- /dev/null
+++ b/_deploy/debian-laptops/localsettings2023-04-05-cleansed.py
@@ -0,0 +1,160 @@
+import os
+import sys
+import urllib.parse
+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.
+
+This file is included at the end of the main troggle/settings.py file so that
+it overwrites defaults in that file.
+
+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.
+"""
+
+print(" * importing troggle/localsettings.py")
+
+# DO NOT check this file into the git repo - it contains real passwords.
+
+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
+
+DATABASES = {
+ '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.
+ 'PASSWORD' : '123456789012345', # Not used with sqlite3. Not a real password.
+ 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
+
+
+EXPOUSER = 'expo'
+EXPOUSERPASS = 'Not a real password'
+EXPOADMINUSER = 'expoadmin'
+EXPOADMINUSERPASS = 'Not a real password'
+EXPOUSER_EMAIL = 'wookey@wookware.org'
+EXPOADMINUSER_EMAIL = 'wookey@wookware.org'
+
+REPOS_ROOT_PATH = '/home/expo/'
+sys.path.append(REPOS_ROOT_PATH)
+sys.path.append(REPOS_ROOT_PATH + 'troggle')
+# Define the path to the django app (troggle in this case)
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+
+
+PHOTOS_YEAR = "2023"
+# add in 358 when they don't make it crash horribly
+NOTABLECAVESHREFS = [ "290", "291", "359", "264", "258", "204", "76", "107"]
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ PYTHON_PATH + "templates"
+ ],
+ '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
+ 'django.template.context_processors.debug',
+ #'django.template.context_processors.request', # copy of current request, added in trying to make csrf work
+ '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
+ 'django.template.context_processors.tz',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ 'loaders': [
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader', #For each app, inc admin, in INSTALLED_APPS, loader looks for /templates
+ # insert your own TEMPLATE_LOADERS here
+ ]
+ },
+ },
+]
+
+PUBLIC_SITE = True
+
+# This should be False for normal running
+DEBUG = False
+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
+
+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/'
+FILES = REPOS_ROOT_PATH + 'expofiles'
+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
+
+
+CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
+ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
+
+
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+
+
+#URL_ROOT = 'http://expo.survex.com/'
+URL_ROOT = '/'
+DIR_ROOT = Path("") #this should end in / if a value is given
+EXPOWEB_URL = '/'
+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/')
+PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/')
+
+# MEDIA_URL is used by urls.py in a regex. See urls.py & core/views_surveys.py
+MEDIA_URL = '/site_media/'
+
+
+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 ?
+# STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
+
+#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
+
+LOGFILE = '/var/log/troggle/troggle.log'
+IMPORTLOGFILE = '/var/log/troggle/import.log'
+
+# 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) + "/"
+
+print(" + finished importing troggle/localsettings.py")
diff --git a/_deploy/debian-laptops/localsettings2023-04-05-secret.py b/_deploy/debian-laptops/localsettings2023-04-05-secret.py
new file mode 100644
index 0000000..f73b512
--- /dev/null
+++ b/_deploy/debian-laptops/localsettings2023-04-05-secret.py
@@ -0,0 +1,160 @@
+import os
+import sys
+import urllib.parse
+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.
+
+This file is included at the end of the main troggle/settings.py file so that
+it overwrites defaults in that file.
+
+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.
+"""
+
+print(" * importing troggle/localsettings.py")
+
+# DO NOT check this file into the git repo - it contains real passwords.
+
+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
+
+DATABASES = {
+ '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.
+ 'PASSWORD' : 'uFqP56B4XleeyIW', # 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.
+ }
+}
+
+
+EXPOUSER = 'expo'
+EXPOUSERPASS = '161:gosser'
+EXPOADMINUSER = 'expoadmin'
+EXPOADMINUSERPASS = 'gosser:161'
+EXPOUSER_EMAIL = 'wookey@wookware.org'
+EXPOADMINUSER_EMAIL = 'wookey@wookware.org'
+
+REPOS_ROOT_PATH = '/home/expo/'
+sys.path.append(REPOS_ROOT_PATH)
+sys.path.append(REPOS_ROOT_PATH + 'troggle')
+# Define the path to the django app (troggle in this case)
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+
+
+PHOTOS_YEAR = "2023"
+# add in 358 when they don't make it crash horribly
+NOTABLECAVESHREFS = [ "290", "291", "359", "264", "258", "204", "76", "107"]
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ PYTHON_PATH + "templates"
+ ],
+ '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
+ 'django.template.context_processors.debug',
+ #'django.template.context_processors.request', # copy of current request, added in trying to make csrf work
+ '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
+ 'django.template.context_processors.tz',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ 'loaders': [
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader', #For each app, inc admin, in INSTALLED_APPS, loader looks for /templates
+ # insert your own TEMPLATE_LOADERS here
+ ]
+ },
+ },
+]
+
+PUBLIC_SITE = True
+
+# This should be False for normal running
+DEBUG = False
+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
+
+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/'
+FILES = REPOS_ROOT_PATH + 'expofiles'
+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
+
+
+CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
+ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
+
+
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+
+
+#URL_ROOT = 'http://expo.survex.com/'
+URL_ROOT = '/'
+DIR_ROOT = Path("") #this should end in / if a value is given
+EXPOWEB_URL = '/'
+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/')
+PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/')
+
+# MEDIA_URL is used by urls.py in a regex. See urls.py & core/views_surveys.py
+MEDIA_URL = '/site_media/'
+
+
+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 ?
+# STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
+
+#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
+
+LOGFILE = '/var/log/troggle/troggle.log'
+IMPORTLOGFILE = '/var/log/troggle/import.log'
+
+# 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) + "/"
+
+print(" + finished importing troggle/localsettings.py")
diff --git a/_deploy/debian-laptops/localsettingsserver2023-01-cleansed.py b/_deploy/debian-laptops/localsettingsserver2023-01-cleansed.py
new file mode 100644
index 0000000..a1e22ca
--- /dev/null
+++ b/_deploy/debian-laptops/localsettingsserver2023-01-cleansed.py
@@ -0,0 +1,164 @@
+import os
+import sys
+import urllib.parse
+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")
+
+# DO NOT check this file into the git repo - it contains real passwords.
+
+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
+
+DATABASES = {
+ '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.
+ 'PASSWORD' : '123456789012345', # Not used with sqlite3.Not the real password
+ 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
+
+
+EXPOUSER = 'expo'
+EXPOADMINUSER = 'expoadmin'
+EXPOUSER_EMAIL = 'wookey@wookware.org'
+EXPOADMINUSER_EMAIL = 'wookey@wookware.org'
+
+SECRET_KEY = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
+EXPOUSERPASS = "nope"
+EXPOADMINUSERPASS = "nope"
+EMAIL_HOST_PASSWORD = "nope"
+
+REPOS_ROOT_PATH = '/home/expo/'
+sys.path.append(REPOS_ROOT_PATH)
+sys.path.append(REPOS_ROOT_PATH + 'troggle')
+# Define the path to the django app (troggle in this case)
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+PHOTOS_YEAR = "2022"
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ PYTHON_PATH + "templates"
+ ],
+ '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
+ 'django.template.context_processors.debug',
+ #'django.template.context_processors.request', # copy of current request, added in trying to make csrf work
+ '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
+ 'django.template.context_processors.tz',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ 'loaders': [
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader', #For each app, inc admin, in INSTALLED_APPS, loader looks for /templates
+ # insert your own TEMPLATE_LOADERS here
+ ]
+ },
+ },
+]
+
+PUBLIC_SITE = True
+
+# This should be False for normal running
+DEBUG = True
+CACHEDPAGES = True # experimental page cache for a handful of page types
+
+SURVEX_DATA = REPOS_ROOT_PATH + 'loser/'
+DRAWINGS_DATA = REPOS_ROOT_PATH + 'drawings/'
+
+# executables:
+CAVERN = 'cavern' # for parsing .svx files and producing .3d files
+SURVEXPORT = 'survexport' # for parsing .3d files and producing .pos files
+
+EXPOWEB = REPOS_ROOT_PATH + 'expoweb/'
+#SURVEYS = REPOS_ROOT_PATH
+SCANS_ROOT = REPOS_ROOT_PATH + 'expofiles/surveyscans/'
+FILES = REPOS_ROOT_PATH + 'expofiles'
+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
+
+
+CAVEDESCRIPTIONS = os.path.join(EXPOWEB, "cave_data")
+ENTRANCEDESCRIPTIONS = os.path.join(EXPOWEB, "entrance_data")
+
+# CACHEDIR = REPOS_ROOT_PATH + 'expowebcache/'
+# THREEDCACHEDIR = CACHEDIR + '3d/'
+# THUMBNAILCACHE = CACHEDIR + 'thumbs'
+
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
+LIBDIR = Path(REPOS_ROOT_PATH) / 'lib' / PV
+
+#Note that all these *_URL constants are not actually used in urls.py, they should be..
+#URL_ROOT = 'http://expo.survex.com/'
+URL_ROOT = '/'
+DIR_ROOT = ''#this should end in / if a value is given
+EXPOWEB_URL = '/'
+SCANS_URL = '/survey_scans/'
+EXPOFILES = urllib.parse.urljoin(REPOS_ROOT_PATH, 'expofiles/')
+PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/')
+
+# MEDIA_URL is used by urls.py in a regex. See urls.py & core/views_surveys.py
+MEDIA_URL = '/site_media/'
+
+
+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 ?
+
+#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
+
+LOGFILE = '/var/log/troggle/troggle.log'
+IMPORTLOGFILE = '/var/log/troggle/import.log'
+
+# add in 358 when they don't make it crash horribly
+NOTABLECAVESHREFS = [ "290", "291", "359", "264", "258", "204", "76", "107"]
+
+# Sanitise these to be strings as all other code is expecting strings
+# and we have not made the change to pathlib Path type in the other localsettings-* variants yet.
+CAVEDESCRIPTIONS = os.fspath(CAVEDESCRIPTIONS)
+ENTRANCEDESCRIPTIONS = os.fspath(ENTRANCEDESCRIPTIONS)
+LOGFILE = os.fspath(LOGFILE)
+#SURVEYS = os.fspath(SURVEYS)
+EXPOWEB = os.fspath(EXPOWEB)
+DRAWINGS_DATA = os.fspath(DRAWINGS_DATA)
+SURVEX_DATA = os.fspath(SURVEX_DATA)
+REPOS_ROOT_PATH = os.fspath(REPOS_ROOT_PATH)
+TEMPLATE_PATH = os.fspath(TROGGLE_PATH)
+MEDIA_ROOT = os.fspath(MEDIA_ROOT)
+JSLIB_ROOT = os.fspath(JSLIB_ROOT)
+SCANS_ROOT = os.fspath(SCANS_ROOT)
+LIBDIR = os.fspath(LIBDIR)
+
+print(" + finished importing troggle/localsettings.py") \ No newline at end of file
diff --git a/_deploy/debian-laptops/os-trog.sh b/_deploy/debian-laptops/os-trog.sh
new file mode 100644
index 0000000..3c5dd36
--- /dev/null
+++ b/_deploy/debian-laptops/os-trog.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+# Run this in a terminal in the troggle directory: 'bash os-trog.sh'
+# On WSL, do Shift-click in the file explorer on the troggle folder to open a Linux command line
+# 'Open Linux shell here'
+echo 'Run this in a terminal in the troggle directory: "bash venv-trog.sh"'
+cat /etc/os-release
+# Expects an Ubuntu 22.04 relatively clean install.
+
+sudo apt install python-is-python3 -y
+python --version : ensure python is an alias for python3 not python2.7
+sudo apt update -y
+sudo apt dist-upgrade -y
+sudo apt autoremove -y
+sudo apt install sqlite3 -y
+sudo apt install python3-pip -y
+
+# this installs a shed-load of other stuff: binutils etc.sudo apt install survex-aven
+sudo apt install git openssh-client -y
+# On a clean debian 11 (bullseye) installation with Xfce & ssh,
+
+ #on ubuntu 20.04:
+ #Package sftp is not available, but is referred to by another package.
+ #This may mean that the package is missing, has been obsoleted, or
+ #is only available from another source
+ #E: Package 'sftp' has no installation candidate
+
+
+# On Ubuntu 20.04, with python10, the pip install fails.
+# So you need to get the pip from source
+# sudo curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
+# but really you should be using 22.04
+# and also, isf using debian,
+# sudo python3.10 -m pip install -U virtualenv
+
+# as debian does not install everything that ubuntu does, you need:
+sudo useradd expo
+sudo usermod -a -G sudo expo # to put expo in sudoers group, re-login required
+sudo apt install python3-venv -y
+sudo apt install python3-dev -y
+
+# default since 22.04
+# sudo apt install python3.10
+sudo apt install python3.10-venv -y
+sudo apt install python3.10-dev -y
+sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
+
+sudo apt install mariadb-server -y
+sudo apt install libmariadb-dev -y
+
+sudo python -m pip install --upgrade pip
+
+sudo apt install sftp -y
+echo '###'
+echo '### NOW INSTALLING tunnel and therion, go and have a cup of tea. Or a 3-course meal.'
+echo '###'
+sudo apt install tunnelx therion -y
+
+# Go to https://expo.survex.com/handbook/troggle/troglaptop.html#dbtools
+# sudo service mysql start
+
+git config --global user.email "you@example.com"
+git config --global user.name "Your Name"
+
+echo '###'
+echo '### Currently set version of python'
+python --version
+
+echo '###'
+echo '### Now YOU have to configure the git settings for YOURSELF (not "expo")'
+
diff --git a/_deploy/debian/settings.py b/_deploy/debian-laptops/settings2023-02-10.py
index 938c024..938c024 100644
--- a/_deploy/debian/settings.py
+++ b/_deploy/debian-laptops/settings2023-02-10.py
diff --git a/_deploy/debian-laptops/settings2023-04-23.py b/_deploy/debian-laptops/settings2023-04-23.py
new file mode 100644
index 0000000..938c024
--- /dev/null
+++ b/_deploy/debian-laptops/settings2023-04-23.py
@@ -0,0 +1,147 @@
+"""
+Django settings for troggle project.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/dev/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/dev/ref/settings/
+"""
+# Imports should be grouped in the following order:
+
+# 1.Standard library imports.
+# 2.Related third party imports.
+# 3.Local application/library specific imports.
+# 4.You should put a blank line between each group of imports.
+
+
+
+print("* importing troggle/settings.py")
+
+# default value, then gets overwritten by real secrets
+SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"
+
+GIT = "git" # command for running git
+
+# Note that this builds upon the django system installed
+# global settings in
+# django/conf/global_settings.py which is automatically loaded first.
+# read https://docs.djangoproject.com/en/dev/topics/settings/
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
+
+# Django settings for troggle project.
+
+ALLOWED_HOSTS = ["*", "expo.survex.com", ".survex.com", "localhost", "127.0.0.1", "192.168.0.5"]
+
+ADMINS = (
+ # ('Your Name', 'your_email@domain.com'),
+)
+MANAGERS = ADMINS
+
+# LOGIN_URL = '/accounts/login/' # this is the default value so does not need to be set
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+USE_TZ = True
+TIME_ZONE = "Europe/London"
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = "en-uk"
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+USE_L10N = True
+
+FIX_PERMISSIONS = []
+
+# top-level survex file basename (without .svx)
+SURVEX_TOPNAME = "1623-and-1626-no-schoenberg-hs"
+
+
+# Caves for which survex files exist, but are not otherwise registered
+# replaced (?) by expoweb/cave_data/pendingcaves.txt
+# PENDING = ["1626-361", "2007-06", "2009-02",
+# "2012-ns-01", "2012-ns-02", "2010-04", "2012-ns-05", "2012-ns-06",
+# "2012-ns-07", "2012-ns-08", "2012-ns-12", "2012-ns-14", "2012-ns-15", "2014-bl888",
+# "2018-pf-01", "2018-pf-02"]
+
+APPEND_SLASH = (
+ False # never relevant because we have urls that match unknown files and produce an 'edit this page' response
+)
+SMART_APPEND_SLASH = True # not eorking as middleware different after Dj2.0
+
+
+LOGIN_REDIRECT_URL = "/" # does not seem to have any effect
+
+SECURE_CONTENT_TYPE_NOSNIFF = True
+SECURE_BROWSER_XSS_FILTER = True
+# SESSION_COOKIE_SECURE = True # if enabled, cannot login to Django control panel, bug elsewhere?
+# CSRF_COOKIE_SECURE = True # if enabled only sends cookies over SSL
+X_FRAME_OPTIONS = "DENY" # changed to "DENY" after I eliminated all the iframes e.g. /xmlvalid.html
+
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" # from Django 3.2
+
+INSTALLED_APPS = (
+ "django.contrib.admin",
+ "django.contrib.auth", # includes the url redirections for login, logout
+ "django.contrib.contenttypes",
+ "django.contrib.sessions",
+ "django.contrib.messages",
+ "django.contrib.admindocs",
+ "django.forms", # Required to customise widget templates
+ # 'django.contrib.staticfiles', # We put our CSS etc explicitly in the right place so do not need this
+ "troggle.core",
+)
+
+FORM_RENDERER = "django.forms.renderers.TemplatesSetting" # Required to customise widget templates
+
+# See the recommended order of these in https://docs.djangoproject.com/en/dev/ref/middleware/
+# Note that this is a radically different onion architecture from earlier versions though it looks the same,
+# see https://docs.djangoproject.com/en/dev/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
+# Seriously, read this: https://www.webforefront.com/django/middlewaredjango.html which is MUCH BETTER than the docs
+MIDDLEWARE = [
+ #'django.middleware.security.SecurityMiddleware', # SECURE_SSL_REDIRECT and SECURE_SSL_HOST # we don't use this
+ "django.middleware.gzip.GZipMiddleware", # not needed when expofiles and photos served by apache
+ "django.contrib.sessions.middleware.SessionMiddleware", # Manages sessions, if CSRF_USE_SESSIONS then it needs to be early
+ "django.middleware.common.CommonMiddleware", # DISALLOWED_USER_AGENTS, APPEND_SLASH and PREPEND_WWW
+ "django.middleware.csrf.CsrfViewMiddleware", # Cross Site Request Forgeries by adding hidden form fields to POST
+ "django.contrib.auth.middleware.AuthenticationMiddleware", # Adds the user attribute, representing the currently-logged-in user
+ "django.contrib.admindocs.middleware.XViewMiddleware", # this and docutils needed by admindocs
+ "django.contrib.messages.middleware.MessageMiddleware", # Cookie-based and session-based message support. Needed by admin system
+ "django.middleware.clickjacking.XFrameOptionsMiddleware", # clickjacking protection via the X-Frame-Options header
+ #'django.middleware.security.SecurityMiddleware', # SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, SECURE_REFERRER_POLICY, and SECURE_SSL_REDIRECT
+ #'troggle.core.middleware.SmartAppendSlashMiddleware' # needs adapting after Dj2.0
+]
+
+ROOT_URLCONF = "troggle.urls"
+
+WSGI_APPLICATION = "troggle.wsgi.application" # change to asgi as soon as we upgrade to Django 3.0
+
+ACCOUNT_ACTIVATION_DAYS = 3
+
+# AUTH_PROFILE_MODULE = 'core.person' # used by removed profiles app ?
+
+QM_PATTERN = "\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]"
+
+# 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
+
+TEST_RUNNER = "django.test.runner.DiscoverRunner"
+
+from localsettings import *
+
+# localsettings needs to take precedence. Call it to override any existing vars.
diff --git a/_deploy/debian-laptops/venv-trog-crowley.sh b/_deploy/debian-laptops/venv-trog-crowley.sh
new file mode 100644
index 0000000..b2d0987
--- /dev/null
+++ b/_deploy/debian-laptops/venv-trog-crowley.sh
@@ -0,0 +1,173 @@
+#!/bin/bash
+# Crowley has python 3.9.2
+# Taken from: footled lots to make this work with python 3.10 & 3.11 and WSL1 and WSL2 on Ubuntu 22.04
+# Run this in a terminal in the troggle directory: 'bash venv-trog-crowley.sh'
+echo '-- DONT RUN THIS - messes up permissions!'
+
+
+echo '-- Run this in a terminal in the real troggle directory: "bash venv-trog-crowley.sh"'
+# use the script os-trog-crowley.sh
+
+# If you are using Debian, then stick with the default version of python
+# If you are using Ubuntu, then it is easy to use a later version of python, e.g. 3.11
+
+
+# NOW we set up troggle
+PYTHON=python3.9
+VENAME=p9d4 # python3.x and django 4
+echo "** You are logged in as `id -u -n`"
+echo "The 50MB pip cache will be in /home/`id -u -n`/.cache/"
+echo "The 150MB venv will created in /home/`id -u -n`/$VENAME/"
+TROGDIR=$(cd $(dirname $0) && pwd)
+echo "-- Troggle folder (this script location): ${TROGDIR}"
+
+if [ -d requirements.txt ]; then
+ echo "-- No requirements.txt found. Copy it from your most recent installation."
+ exit 1
+fi
+echo ## Using requirements.txt :
+cat requirements.txt
+echo ##
+
+
+$PYTHON --version
+
+# NOTE that when using a later or earlier verison of python, you MUST also
+# use the allowed version of Pillow, see https://pillow.readthedocs.io/en/latest/installation.html
+
+# NOW set up link from expo user folder
+# needed for WSL2
+echo Creating links from Linux filesystem user
+# These links only need making once, for many venv
+cd ~
+
+if [ ! -d $VENAME ]; then
+ echo "## Creating venv $VENAME. (If this fails with a pip error, you need to ensure you have python3.11-venv installed and/or use a Ubuntu window)"
+ $PYTHON -m venv $VENAME
+else
+ echo "## /$VENAME/ already exists ! Delete it first."
+ exit 1
+fi
+
+ # Activate the virtual env and see what the default packages are
+echo "### Activating $VENAME"
+
+cd $VENAME
+echo "-- now in: ${PWD}"
+source bin/activate
+echo "### Activated."
+ # update local version of pip, more recent than OS version
+ # debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3
+
+ # update local version of setuptools, more recent than OS version, needed for packages without wheels
+
+echo "### installing later version of pip inside $VENAME"
+$PYTHON -m pip install --upgrade pip
+$PYTHON -m pip install --upgrade setuptools
+
+PIP=pip
+
+$PIP list > original-pip.list
+$PIP freeze >original.txt
+
+# we are in /home/$USER/$VENAME/
+ln -s ${TROGDIR} troggle
+ln -s ${TROGDIR}/../expoweb expoweb
+ln -s ${TROGDIR}/../loser loser
+ln -s ${TROGDIR}/../drawings drawings
+
+# fudge for philip's machine
+if [ -d ${TROGDIR}/../expofiles ]; then
+ ln -s ${TROGDIR}/../expofiles expofiles
+else
+ if [ ! -d /mnt/f/expofiles ]; then
+ sudo mkdir /mnt/f
+ sudo mount -t drvfs F: /mnt/f
+ else
+ ln -s /mnt/f/expofiles expofiles
+ fi
+fi
+
+echo "### Setting file permissions.. may take a while.."
+git config --global --add safe.directory '*'
+#sudo chmod -R 0777 *
+
+echo "### links to expoweb, troggle etc. complete:"
+ls -tla
+
+echo "###"
+echo "### now installing ${TROGDIR}/requirements.txt"
+echo "###"
+
+# NOW THERE IS A PERMISSIONS FAILURE THAT DIDN'T HAPPEN BEFORE
+# seen on wsl2 as well as wsl1
+# which ALSO ruins EXISTING permissions !
+# Guessing it is to do with pip not liking non-standard py 3.11 installation on Ubuntu 22.04
+
+$PIP install -r ${TROGDIR}/requirements.txt
+echo '### install from requirements.txt completed.'
+echo '### '
+
+$PIP freeze > requirements.txt
+# so that we can track requirements more easily with git
+# because we do not install these with pip, but they are listed by the freeze command
+# Now find out what we actually installed by subtracting the stuff venv installed anyway
+sort original.txt > 1
+sort requirements.txt >2
+comm -3 1 2 --check-order | awk '{ print $1}'>fresh-requirements.txt
+rm 1
+rm 2
+
+cp requirements.txt requirements-$VENAME.txt
+cp requirements-$VENAME.txt troggle/requirements-$VENAME.txt
+
+$PIP list > installed-pip.list
+$PIP list -o > installed-pip-o.list
+
+REQ=installation-record
+mkdir $REQ
+mv requirements-$VENAME.txt $REQ
+mv original.txt $REQ
+mv requirements.txt $REQ
+mv original-pip.list $REQ
+mv installed-pip.list $REQ
+mv installed-pip-o.list $REQ
+cp fresh-requirements.txt ../requirements.txt
+mv fresh-requirements.txt $REQ
+cp troggle/`basename "$0"` $REQ
+
+
+$PYTHON --version
+python --version
+echo "Django version:`django-admin --version`"
+
+echo "### Now do
+ '[sudo service mysql start]'
+ '[sudo service mariadb restart]'
+ '[sudo mysql_secure_installation]'
+ 'cd ~/$VENAME'
+ 'source bin/activate'
+ 'cd troggle'
+ 'django-admin'
+ 'python manage.py check'
+## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html
+## you need to follow the Linux instructions.
+ 'ssh expo@expo.survex.com'
+
+## the next tests will fail unless ~/expofiles is set correctly to a folder on your machine
+## the tests may ALSO fail because of ssh and permissions errors
+# Ran 85 tests in 83.492s
+# FAILED (failures=5)
+## So you will need to run
+#$sudo chown -Rhv philip:philip ~/$VENAME (if your username is philip)
+# and then REBOOT (or at least, exit WSL and terminate and restart WSL)
+# because this chmod only takes effect then.
+
+ './pre-run.sh' (runs the migrations and then the tests)
+
+ 'python databaseReset.py reset $VENAME'
+ 'python manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)'
+ "
+if [ ! -d /mnt/f/expofiles ]; then
+echo '### No valid expofiles directory. Fix this before any tests will work.
+fi
diff --git a/_deploy/debian/apache2.conf b/_deploy/debian-server/apache2.conf
index ae4b2c3..ae4b2c3 100644
--- a/_deploy/debian/apache2.conf
+++ b/_deploy/debian-server/apache2.conf
diff --git a/_deploy/debian/envvars b/_deploy/debian-server/envvars
index d3e69a6..d3e69a6 100644
--- a/_deploy/debian/envvars
+++ b/_deploy/debian-server/envvars
diff --git a/_deploy/debian/localsettingsserver-old.py b/_deploy/debian-server/localsettingsserver-old.py
index 72ab0f0..72ab0f0 100644
--- a/_deploy/debian/localsettingsserver-old.py
+++ b/_deploy/debian-server/localsettingsserver-old.py
diff --git a/_deploy/debian/localsettingsserver.py b/_deploy/debian-server/localsettingsserver2023-01-secret.py
index d99e61d..d99e61d 100644
--- a/_deploy/debian/localsettingsserver.py
+++ b/_deploy/debian-server/localsettingsserver2023-01-secret.py
diff --git a/_deploy/debian-server/requirements-server.txt b/_deploy/debian-server/requirements-server.txt
new file mode 100644
index 0000000..1a5abb1
--- /dev/null
+++ b/_deploy/debian-server/requirements-server.txt
@@ -0,0 +1,23 @@
+#This requirements txt matches the libaries as of 2023-07-09 on expo.survex.com <Debian GNU/Linux 11 (bullseye)>
+
+#Nb on the server asgiref==3.3.0, however this conflicts with the Django==3.2.12 requirement
+asgiref==3.3.2
+Django==3.2.12
+docutils==0.16
+packaging==20.9
+Pillow==8.1.2
+pytz==2021.1
+sqlparse==0.4.1
+Unidecode==1.2.0
+beautifulsoup4==4.9.3
+piexif==1.1.3
+
+#Not installed on expo.survex.com
+#black==23.3
+#click==8.1.3
+#coverage==7.2
+#isort==5.12.0
+#mypy-extensions==1.0.0
+#pathspec==0.11
+#platformdirs==3.8
+#ruff==0.0.245
diff --git a/_deploy/debian/serversetup b/_deploy/debian-server/serversetup
index 1c54546..1c54546 100644
--- a/_deploy/debian/serversetup
+++ b/_deploy/debian-server/serversetup
diff --git a/_deploy/debian/sitecustomize.py b/_deploy/debian-server/sitecustomize.py
index 89c6712..89c6712 100644
--- a/_deploy/debian/sitecustomize.py
+++ b/_deploy/debian-server/sitecustomize.py
diff --git a/_deploy/debian/this-is-the-live-expo.survex.com-system.txt b/_deploy/debian-server/this-is-the-live-expo.survex.com-system.txt
index e69de29..e69de29 100644
--- a/_deploy/debian/this-is-the-live-expo.survex.com-system.txt
+++ b/_deploy/debian-server/this-is-the-live-expo.survex.com-system.txt
diff --git a/_deploy/debian/wookey-exposerver-recipe.txt b/_deploy/debian-server/wookey-exposerver-recipe.txt
index 6bcdc57..6bcdc57 100644
--- a/_deploy/debian/wookey-exposerver-recipe.txt
+++ b/_deploy/debian-server/wookey-exposerver-recipe.txt
diff --git a/_deploy/potatohut/localsettingspotatohut.py b/_deploy/potatohut/localsettingspotatohut.py
deleted file mode 100644
index 184f0ab..0000000
--- a/_deploy/potatohut/localsettingspotatohut.py
+++ /dev/null
@@ -1,79 +0,0 @@
-import sys
-
-# This is an example file. Copy it to localsettings.py, set the
-# password and _don't_ check that file back to the repo as it exposes
-# your/our password to the world!
-
-# This will ALL NEED TO BE CHANGED to match localsettingsWSL / python3 / Django v1.18.29
-# This WILL NOT WORK as it is for an earlier version of Django
-
-
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'troggle', # Or path to database file if using sqlite3.
- 'USER': 'expo', # Not used with sqlite3.
- 'PASSWORD': 'notarealpassword', # 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.
- }
-}
-
-REPOS_ROOT_PATH = '/home/expo/'
-sys.path.append(REPOS_ROOT_PATH)
-sys.path.append(REPOS_ROOT_PATH + 'troggle')
-
-PUBLIC_SITE = True
-FIX_PERMISSIONS = ["sudo", "/usr/local/bin/fix_permissions"]
-
-SURVEX_DATA = REPOS_ROOT_PATH + 'loser/'
-DRAWINGS_DATA = REPOS_ROOT_PATH + 'drawings/'
-THREEDCACHEDIR = REPOS_ROOT_PATH + 'expowebcache/3d/'
-
-CAVERN = 'cavern'
-THREEDTOPOS = '3dtopos'
-EXPOWEB = REPOS_ROOT_PATH + 'expoweb/'
-SURVEYS = REPOS_ROOT_PATH
-SURVEY_SCANS = REPOS_ROOT_PATH + 'expoimages/'
-FILES = REPOS_ROOT_PATH + 'expoimages'
-
-
-PYTHON_PATH = '/home/expo/troggle/'
-
-URL_ROOT = "http://expo/"
-DIR_ROOT = ''#this should end in / if a value is given
-EXPOWEB_URL = 'http://expo/'
-SURVEYS_URL = 'http://expo/survey_scans/'
-MEDIA_URL = '/' + DIR_ROOT + 'site_media/'
-
-STATIC_URL = URL_ROOT
-STATIC_ROOT = DIR_ROOT
-
-MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/'
-MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/'
-
-JSLIB_PATH = '/usr/share/javascript/'
-
-TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/'
-TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + 'tinymce_media/'
-
-TEMPLATE_DIRS = (
- PYTHON_PATH + "templates",
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
-)
-
-LOGFILE = '/home/expo/troggle/troggle_log.txt'
-
-FEINCMS_ADMIN_MEDIA='/site_media/feincms/'
-
-EMAIL_HOST = "smtp.gmail.com"
-
-EMAIL_HOST_USER = "cuccexpo@gmail.com"
-
-EMAIL_HOST_PASSWORD = "insert-real-email-password-here"
-
-EMAIL_PORT=587
-
-EMAIL_USE_TLS = True
diff --git a/_deploy/readme.txt b/_deploy/readme.txt
new file mode 100644
index 0000000..0986324
--- /dev/null
+++ b/_deploy/readme.txt
@@ -0,0 +1,18 @@
+2023-07-17 Philip Sargent
+
+Trying to sort out configurations as we got into a bit of a mess on
+Expo in the last couple of weeks with two (notionally identical Debian
+Bullseye) expo laptops Crowley (which has local troggle installed and
+can run locally) and Aziraphale (has local copy of troggle repo but is
+not configured to run locally), Martin Green's laptop (Ubuntu 22.04.2),
+Philip's Barbie laptop Ubuntu 22.04.3). And of course the server itself
+expo.survex.com which is running Debian Bullseye. But most development
+recently had been done on Philip's two other machines, desktop and PC,
+both running Ubuntu on WSL on Windows and both using venv environments,
+which Crowley also does.
+
+- settings.py
+is common to all configurations,
+but these are all different:
+- localsettings.py
+- requirements.txt \ No newline at end of file
diff --git a/_deploy/ubuntu/localsettingsubuntu.py b/_deploy/ubuntu-dev/localsettingsubuntu.py
index 63d3ecc..63d3ecc 100644
--- a/_deploy/ubuntu/localsettingsubuntu.py
+++ b/_deploy/ubuntu-dev/localsettingsubuntu.py
diff --git a/_deploy/wsl/localsettingsWSL.py b/_deploy/wsl/localsettingsWSL.py
index ffead19..2824125 100644
--- a/_deploy/wsl/localsettingsWSL.py
+++ b/_deploy/wsl/localsettingsWSL.py
@@ -47,6 +47,7 @@ PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
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"
@@ -64,9 +65,9 @@ NOTABLECAVESHREFS = ["290", "291", "264", "258", "204", "359", "76", "107"]
# PYTHON_PATH = os.fspath(PYTHON_PATH)
PYTHON_PATH = REPOS_ROOT_PATH / "troggle"
LOGFILE = PYTHON_PATH / "troggle.log"
+SQLITEDB = PYTHON_PATH / "troggle.sqlite"
+KMZ_ICONS_PATH = PYTHON_PATH / "kmz_icons"
-#sys.path.append(os.fspath(REPOS_ROOT_PATH))
-#sys.path.append(os.fspath(PYTHON_PATH))
# 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).
@@ -99,7 +100,7 @@ DBSQLITE = {
"default": {
"ENGINE": "django.db.backends.sqlite3", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
#'NAME' : 'troggle.sqlite',
- "NAME": "/home/philip/p11d4/troggle.sqlite",
+ "NAME": str(SQLITEDB),
"USER": "expo", # Not used with sqlite3.
"PASSWORD": "sekrit", # Not used with sqlite3.
"HOST": "", # Set to empty string for localhost. Not used with sqlite3.
diff --git a/_deploy/wsl/requirements-devupgrade.txt b/_deploy/wsl/requirements-devupgrade.txt
new file mode 100644
index 0000000..19fe6d8
--- /dev/null
+++ b/_deploy/wsl/requirements-devupgrade.txt
@@ -0,0 +1,20 @@
+# Philip bleeding edge config
+asgiref==3.6.0
+beautifulsoup4==4.12.2
+black==23.1.0
+click==8.1.3
+coverage==7.1.0
+Django==4.2
+docutils==0.19
+isort==5.12.0
+mypy-extensions==1.0.0
+packaging==23.0
+pathspec==0.11.0
+Pillow==9.4.0
+platformdirs==3.0.0
+pytz==2022.7
+ruff==0.0.245
+soupsieve==2.4.1
+sqlparse==0.4.3
+Unidecode==1.3.6
+piexif==1.1.3 \ No newline at end of file
diff --git a/_deploy/wsl/venv-trog.sh b/_deploy/wsl/venv-trog.sh
new file mode 100644
index 0000000..2133bef
--- /dev/null
+++ b/_deploy/wsl/venv-trog.sh
@@ -0,0 +1,171 @@
+#!/bin/bash
+# footled lots to make this work with python 3.10 & 3.11 and WSL1 and WSL2 on Ubuntu 22.04
+# Run this in a terminal in the troggle directory: 'bash venv-trog.sh'
+echo '-- Run this in a terminal in the real troggle directory: "bash venv-trog.sh"'
+
+# Expects an Ubuntu 22.04 (or 20.04) relatively clean install.
+# If you have not already installed these on your clean Ubuntu install DO THIS FIRST
+# use the script os-trog.sh
+
+# If you are using Debian, then stick with the default version of python
+# If you are using Ubuntu, then it is easy to use a later version of python, e.g. 3.11
+
+# NOW we set up troggle
+PYTHON=python3.11
+VENAME=p11d4 # python3.x and django 4.2
+echo "** You are logged in as `id -u -n`"
+echo "The 50MB pip cache will be in /home/`id -u -n`/.cache/"
+echo "The 150MB venv will created in /home/`id -u -n`/$VENAME/"
+TROGDIR=$(cd $(dirname $0) && pwd)
+echo "-- Troggle folder (this script location): ${TROGDIR}"
+
+if [ -d requirements.txt ]; then
+ echo "-- No requirements.txt found. You should be in the /troggle/ folder. Copy it from your most recent installation."
+ exit 1
+fi
+echo ## Using requirements.txt :
+cat requirements.txt
+echo ##
+
+
+$PYTHON --version
+
+# NOTE that when using a later or earlier verison of python, you MUST also
+# use the allowed version of Pillow, see https://pillow.readthedocs.io/en/latest/installation.html
+
+# NOW set up link from expo user folder
+# needed for WSL2
+echo Creating links from Linux filesystem user
+# These links only need making once, for many venv
+cd ~
+
+if [ ! -d $VENAME ]; then
+ echo "## Creating venv $VENAME. (If this fails with a pip error, you need to ensure you have python3.11-venv installed and/or use a Ubuntu window)"
+ $PYTHON -m venv $VENAME
+else
+ echo "## /$VENAME/ already exists ! Delete it first."
+ exit 1
+fi
+
+ # Activate the virtual env and see what the default packages are
+echo "### Activating $VENAME"
+
+cd $VENAME
+echo "-- now in: ${PWD}"
+source bin/activate
+echo "### Activated."
+ # update local version of pip, more recent than OS version
+ # debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3
+
+ # update local version of setuptools, more recent than OS version, needed for packages without wheels
+
+echo "### installing later version of pip inside $VENAME"
+$PYTHON -m pip install --upgrade pip
+$PYTHON -m pip install --upgrade setuptools
+
+PIP=pip
+
+$PIP list > original-pip.list
+$PIP freeze >original.txt
+
+# we are in /home/$USER/$VENAME/
+ln -s ${TROGDIR} troggle
+ln -s ${TROGDIR}/../expoweb expoweb
+ln -s ${TROGDIR}/../loser loser
+ln -s ${TROGDIR}/../drawings drawings
+#ln -s ${TROGDIR}/../expofiles expofiles
+
+# fudge for philip's machine
+if [ ! -d /mnt/d/EXPO ]; then
+ sudo mkdir /mnt/d
+ sudo mount -t drvfs D: /mnt/d
+fi
+
+if [ -d ${TROGDIR}/../expofiles ]; then
+ ln -s ${TROGDIR}/../expofiles expofiles
+else
+ ln -s /mnt/d/EXPO/expofiles expofiles
+fi
+
+echo "### Setting file permissions.. may take a while.."
+git config --global --add safe.directory '*'
+sudo chmod -R 777 *
+
+echo "### links to expoweb, troggle etc. complete:"
+ls -tla
+echo "###"
+echo "### now installing ${TROGDIR}/requirements.txt"
+echo "###"
+
+# NOW THERE IS A PERMISSIONS FAILURE THAT DIDN'T HAPPEN BEFORE
+# seen on wsl2 as well as wsl1
+# which ALSO ruins EXISTING permissions !
+# Guessing it is to do with pip not liking non-standard py 3.11 installation on Ubuntu 22.04
+
+$PIP install -r ${TROGDIR}/requirements.txt
+echo '### install from requirements.txt completed.'
+echo '### '
+
+$PIP freeze > requirements.txt
+# so that we can track requirements more easily with git
+# because we do not install these with pip, but they are listed by the freeze command
+# Now find out what we actually installed by subtracting the stuff venv installed anyway
+sort original.txt > 1
+sort requirements.txt >2
+comm -3 1 2 --check-order | awk '{ print $1}'>fresh-requirements.txt
+rm 1
+rm 2
+
+cp requirements.txt requirements-$VENAME.txt
+cp requirements-$VENAME.txt troggle/requirements-$VENAME.txt
+
+$PIP list > installed-pip.list
+$PIP list -o > installed-pip-o.list
+
+REQ=installation-record
+mkdir $REQ
+mv requirements-$VENAME.txt $REQ
+mv original.txt $REQ
+mv requirements.txt $REQ
+mv original-pip.list $REQ
+mv installed-pip.list $REQ
+mv installed-pip-o.list $REQ
+cp fresh-requirements.txt ../requirements.txt
+mv fresh-requirements.txt $REQ
+cp troggle/`basename "$0"` $REQ
+
+
+$PYTHON --version
+python --version
+echo "Django version:`django-admin --version`"
+
+echo "### Now do
+ '[sudo service mysql start]'
+ '[sudo service mariadb restart]'
+ '[sudo mysql_secure_installation]'
+ 'cd ~/$VENAME'
+ 'source bin/activate'
+ 'cd troggle'
+ 'django-admin'
+ 'python manage.py check'
+## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html
+## you need to follow the Linux instructions.
+ 'ssh expo@expo.survex.com'
+
+## the next tests will fail unless ~/expofiles is set correctly to a folder on your machine
+## the tests may ALSO fail because of ssh and permissions errors
+
+## So you will need to run
+$sudo chown -Rhv philip:philip ~/$VENAME (if your username is philip)
+# and then REBOOT (or at least, exit WSL and terminate and restart WSL)
+# because this chmod only takes effect then.
+
+ 'python manage.py test -v 2'
+ './pre-run.sh' (runs the tests again)
+
+ 'python databaseReset.py reset $VENAME'
+ 'python manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)'
+ "
+if [ ! -d /mnt/d/expofiles ]; then
+ echo '### No valid expofiles directory on /mnt/d . Fix this before any tests will work.'
+fi \ No newline at end of file
diff --git a/_deploy/xubuntu/pre-push-barbie.sh b/_deploy/xubuntu/pre-push-barbie.sh
new file mode 100644
index 0000000..5ea1aa0
--- /dev/null
+++ b/_deploy/xubuntu/pre-push-barbie.sh
@@ -0,0 +1,46 @@
+#! /bin/sh
+# create and sanitise files for pushing to repo, for Babie laptop
+
+echo deprecations.
+python -Wall manage.py check -v 3 2>deprecations.txt >/dev/null
+echo diffsettings.
+rm diffsettings.txt
+if test -f "diffsettings.txt"; then
+ echo "diffsettings.txt not deleted. You have a serious permissions problem. Aborting.."
+ exit
+fi
+python manage.py diffsettings | grep "###" > diffsettings.txt
+echo pip freeze.
+pip freeze > requirements.txt
+echo inspectdb.
+# this next line requires database setting to be troggle.sqlite:
+python manage.py inspectdb > troggle-inspectdb.py
+#egrep -in "unable|error" troggle-inspectdb.py
+echo remove passwords.
+cp localsettings.py localsettingsXubuntu.py
+sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg - real-expo-password---imported-from-localsettings.py"/' diffsettings.txt
+sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg - real-expo-password---imported-from-localsettings.py"/' localsettingsXubuntu.py
+echo " reset: EXPOUSERPASS = \"nnn:gggggg\" - real-expo-password---imported-from-localsettings.py"
+
+sed -i '/EXPOADMINUSERPASS/ s/^.*$/EXPOADMINUSERPASS = "gggggg:nnn - real-expo-password---imported-from-localsettings.py"/' diffsettings.txt
+sed -i '/EXPOADMINUSERPASS/ s/^.*$/EXPOADMINUSERPASS = "gggggg:nnn - real-expo-password---imported-from-localsettings.py"/' localsettingsXubuntu.py
+echo " reset: EXPOUSERPASS = \"gggggg:nnn\" - real-expo-password---imported-from-localsettings.py"
+
+sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "real-email-password---imported-from-localsettings.py"/' diffsettings.txt
+sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "real-email-password---imported-from-localsettings.py"/' localsettingsXubuntu.py
+echo " reset: EMAIL_HOST_PASSWORD = \"real-email-password--imported-from-localsettings.py\""
+
+sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "real-SECRET_KEY--imported-from-localsettings.py"/' diffsettings.txt
+sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "real-SECRET_KEY--imported-from-localsettings.py"/' localsettingsXubuntu.py
+echo " reset: SECRET_KEY = \"real-SECRET_KEY--imported-from-localsettings.py\""
+
+mv _deploy/xubuntu/localsettingsXubuntu.py _deploy/xubuntu/localsettingsXubuntu.py.bak
+mv localsettingsXubuntu.py _deploy/xubuntu
+#
+# Do these before final testing, *not* just before pushing:
+# in ./pre-run.sh
+# python reset-django.py
+# python manage.py makemigrations
+# python manage.py test
+# python manage.py inspectdb > troggle-inspectdb.py
+# egrep -i "unable|error" troggle-inspectdb.py