summaryrefslogtreecommitdiffstats
path: root/_deploy/wsl
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-12-20 21:24:46 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2024-12-20 21:24:46 +0000
commit90ecdda407d6e8a51bb5587783d8406718fab0ec (patch)
treeaf3b5e24b97b2338ea11441f47cd0decf517db44 /_deploy/wsl
parent1b6333fdefe9331ea4489248de51ce55552c732c (diff)
downloadtroggle-90ecdda407d6e8a51bb5587783d8406718fab0ec.tar.gz
troggle-90ecdda407d6e8a51bb5587783d8406718fab0ec.tar.bz2
troggle-90ecdda407d6e8a51bb5587783d8406718fab0ec.zip
debugging install scripts on a new 24.04 machine
Diffstat (limited to '_deploy/wsl')
-rw-r--r--_deploy/wsl/localsettingsWSL.py18
-rw-r--r--_deploy/wsl/pre-push.sh25
-rw-r--r--_deploy/wsl/venv-trog.sh42
3 files changed, 32 insertions, 53 deletions
diff --git a/_deploy/wsl/localsettingsWSL.py b/_deploy/wsl/localsettingsWSL.py
index 512ad47..b4458bf 100644
--- a/_deploy/wsl/localsettingsWSL.py
+++ b/_deploy/wsl/localsettingsWSL.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/p12d5/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))
diff --git a/_deploy/wsl/pre-push.sh b/_deploy/wsl/pre-push.sh
index 788b46f..fe6fb0b 100644
--- a/_deploy/wsl/pre-push.sh
+++ b/_deploy/wsl/pre-push.sh
@@ -6,24 +6,27 @@
# Philip Sargent 2022/04/12
echo "** This copies file to _deploy/wsl/ !"
cd ..
-source .venv/bin/activate
+
cd troggle
echo `pwd`
echo deprecations.
-python -Wall manage.py check -v 3 2>deprecations.txt >/dev/null
+PYTHON="uv run"
+
+source .venv/bin/activate
+python3 -Wall manage.py check -v 3 2>deprecations.txt >/dev/null
+deactivate
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 uv pip freeze.
-uv pip freeze > requirements.txt
+$PYTHON manage.py diffsettings | grep "###" > diffsettings.txt
+
echo inspectdb.
# this next line requires database setting to be troggle.sqlite:
-python manage.py inspectdb > troggle-inspectdb.py
+$PYTHON manage.py inspectdb > troggle-inspectdb.py
#egrep -in "unable|error" troggle-inspectdb.py
echo remove passwords.
cp localsettings.py localsettingsWSL.py
@@ -46,12 +49,12 @@ echo " reset: SECRET_KEY = \"real-SECRET_KEY--imported-from-localsettings.py\
mv _deploy/wsl/localsettingsWSL.py _deploy/wsl/localsettingsWSL.py.bak
mv localsettingsWSL.py _deploy/wsl
cp *.sh _deploy/wsl
-deactivate
+
#
# 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
+# $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
diff --git a/_deploy/wsl/venv-trog.sh b/_deploy/wsl/venv-trog.sh
index 43e6ac1..5294646 100644
--- a/_deploy/wsl/venv-trog.sh
+++ b/_deploy/wsl/venv-trog.sh
@@ -1,53 +1,31 @@
#!/bin/bash
# now using uv, unbelieveably simpler.
-# Run this in a terminal in the troggle directory: 'bash venv-trog.sh'
-echo '-- Run this in a terminal in the directory above the troggle directory: "bash troggle/venv-trog.sh"'
+# Run this in a terminal in ~/expo above the troggle directory: 'bash ~/expo/venv-trog.sh'
+echo '-- Run this in a terminal in the directory above the troggle directory: "bash ~/expo/venv-trog.sh"'
-# Expects an Ubuntu 22.04 with all the gubbins already installed
+# Expects an Ubuntu 24.04 with all the gubbins already installed
# If you have not already installed these on your clean Ubuntu install DO THIS FIRST
# use the script os-trog24.04.sh runniing it in /home/username/
-python --version
-
+python3 --version
+cd ~/expo/troggle
echo "-- EXPO folder [current directory]: `pwd`"
TROGDIR=$(cd $(dirname $0) && pwd)
-echo "-- Troggle folder [this script location]: ${TROGDIR}"
+echo "-- Troggle folder: ${TROGDIR}"
-cp troggle/pyproject.toml .
+cp dev.toml pyproject.toml
+cp ~/expo/troggle/_deploy/wsl/localsettingsWSL.py ~/expo/troggle/localsettings.py
uv self update
uv sync
-exit 1
-# this next is a bit wordy
-# uv python list --only-installed
-
-# we are in /home/$USER/expo/
-# 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 laptop prior to M2 SSD upgrade
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
-
-read -p "Press any key to resume ..."
-PIP="uv pip"
-
-
-REQUIRE="requirements.txt"
-$PIP freeze > $REQUIRE
-$PIP list
+uv pip list
echo "Django version:`uv run django-admin --version`"
@@ -55,7 +33,7 @@ echo "### Now do
'[sudo service mysql start]'
'[sudo service mariadb restart]'
'[sudo mysql_secure_installation]'
- 'cd troggle'
+ 'cd ~/expo/troggle'
'uv run django-admin'
'uv run manage.py check'
## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html