2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 17:47:13 +00:00

debugging install scripts on a new 24.04 machine

This commit is contained in:
2024-12-20 21:24:46 +00:00
parent 1b6333fdef
commit 90ecdda407
6 changed files with 63 additions and 126 deletions

View File

@@ -52,17 +52,18 @@ TEMPLATE_PATH = TROGGLE_PATH / "templates"
MEDIA_ROOT = TROGGLE_PATH / "media" MEDIA_ROOT = TROGGLE_PATH / "media"
JSLIB_ROOT = TROGGLE_PATH / "media" / "jslib" # used for CaveViewer JS utility JSLIB_ROOT = TROGGLE_PATH / "media" / "jslib" # used for CaveViewer JS utility
# FILES = Path('/mnt/d/expofiles/')
EXPOFILES = REPOS_ROOT_PATH / "expofiles" EXPOFILES = REPOS_ROOT_PATH / "expofiles"
SCANS_ROOT = EXPOFILES / "surveyscans" SCANS_ROOT = EXPOFILES / "surveyscans"
PHOTOS_ROOT = EXPOFILES / "photos" PHOTOS_ROOT = EXPOFILES / "photos"
PHOTOS_YEAR = "2023" PHOTOS_YEAR = "2024"
NOTABLECAVESHREFS = ["290", "291", "264", "258", "204", "359", "76", "107"] # NOTABLECAVESHREFS = ["290", "291", "264", "258", "204", "359"] # moved to settings.py
PYTHON_PATH = REPOS_ROOT_PATH / "troggle" PYTHON_PATH = REPOS_ROOT_PATH / "troggle"
LOGFILE = PYTHON_PATH / "troggle.log" 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 # 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). # 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 PUBLIC_SITE = True
DEBUG = True # Always keep this True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES ! 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 CACHEDPAGES = True # experimental page cache for a handful of page types
DEVSERVER = True # running on WSL we are always a dev machine
# executables:
CAVERN = "cavern" # for parsing .svx files and producing .3d files
SURVEXPORT = "survexport" # for parsing .3d files and producing .pos files
DBSQLITE = { DBSQLITE = {
"default": { "default": {
"ENGINE": "django.db.backends.sqlite3", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. "ENGINE": "django.db.backends.sqlite3", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
"NAME": "/home/philip/p12d5/troggle.sqlite", "NAME": str(SQLITEDB),
# 'NAME' : ':memory:', # 'NAME' : ':memory:',
"USER": "expo", # Not used with sqlite3. "USER": "expo", # Not used with sqlite3.
"PASSWORD": "sekrit", # Not used with sqlite3. "PASSWORD": "sekrit", # Not used with sqlite3.
@@ -133,7 +131,7 @@ TEMPLATES = [
"context_processors": [ "context_processors": [
# django.template.context_processors.csrf, # is always enabled and cannot be removed, sets csrf_token # 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 "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.debug",
"django.template.context_processors.i18n", "django.template.context_processors.i18n",
"django.template.context_processors.media", # includes a variable MEDIA_URL "django.template.context_processors.media", # includes a variable MEDIA_URL
@@ -167,7 +165,7 @@ EXPOWEB = REPOS_ROOT_PATH / "expoweb"
CAVEDESCRIPTIONS = EXPOWEB / "cave_data" CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data" ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
# EXPOWEB_URL = "" # defunct, removed. EXPOWEB_URL = ""
# SCANS_URL = '/survey_scans/' # defunct, removed. # SCANS_URL = '/survey_scans/' # defunct, removed.
sys.path.append(str(REPOS_ROOT_PATH)) sys.path.append(str(REPOS_ROOT_PATH))

View File

@@ -6,24 +6,27 @@
# Philip Sargent 2022/04/12 # Philip Sargent 2022/04/12
echo "** This copies file to _deploy/wsl/ !" echo "** This copies file to _deploy/wsl/ !"
cd .. cd ..
source .venv/bin/activate
cd troggle cd troggle
echo `pwd` echo `pwd`
echo deprecations. 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. echo diffsettings.
rm diffsettings.txt rm diffsettings.txt
if test -f "diffsettings.txt"; then if test -f "diffsettings.txt"; then
echo "diffsettings.txt not deleted. You have a serious permissions problem. Aborting.." echo "diffsettings.txt not deleted. You have a serious permissions problem. Aborting.."
exit exit
fi fi
python manage.py diffsettings | grep "###" > diffsettings.txt $PYTHON manage.py diffsettings | grep "###" > diffsettings.txt
echo uv pip freeze.
uv pip freeze > requirements.txt
echo inspectdb. echo inspectdb.
# this next line requires database setting to be troggle.sqlite: # 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 #egrep -in "unable|error" troggle-inspectdb.py
echo remove passwords. echo remove passwords.
cp localsettings.py localsettingsWSL.py 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 _deploy/wsl/localsettingsWSL.py _deploy/wsl/localsettingsWSL.py.bak
mv localsettingsWSL.py _deploy/wsl mv localsettingsWSL.py _deploy/wsl
cp *.sh _deploy/wsl cp *.sh _deploy/wsl
deactivate
# #
# Do these before final testing, *not* just before pushing: # Do these before final testing, *not* just before pushing:
# in ./pre-run.sh # in ./pre-run.sh
# python reset-django.py # $PYTHON reset-django.py
# python manage.py makemigrations # $PYTHON manage.py makemigrations
# python manage.py test # $PYTHON manage.py test
# python manage.py inspectdb > troggle-inspectdb.py # $PYTHON manage.py inspectdb > troggle-inspectdb.py
# egrep -i "unable|error" troggle-inspectdb.py # egrep -i "unable|error" troggle-inspectdb.py

View File

@@ -1,53 +1,31 @@
#!/bin/bash #!/bin/bash
# now using uv, unbelieveably simpler. # now using uv, unbelieveably simpler.
# Run this in a terminal in the troggle directory: 'bash 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 troggle/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 # 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/ # 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`" echo "-- EXPO folder [current directory]: `pwd`"
TROGDIR=$(cd $(dirname $0) && 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 self update
uv sync 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 # fudge for philip's laptop prior to M2 SSD upgrade
if [ ! -d /mnt/d/EXPO ]; then if [ ! -d /mnt/d/EXPO ]; then
sudo mkdir /mnt/d sudo mkdir /mnt/d
sudo mount -t drvfs D: /mnt/d sudo mount -t drvfs D: /mnt/d
fi fi
if [ -d ${TROGDIR}/../expofiles ]; then uv pip list
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
echo "Django version:`uv run django-admin --version`" echo "Django version:`uv run django-admin --version`"
@@ -55,7 +33,7 @@ echo "### Now do
'[sudo service mysql start]' '[sudo service mysql start]'
'[sudo service mariadb restart]' '[sudo service mariadb restart]'
'[sudo mysql_secure_installation]' '[sudo mysql_secure_installation]'
'cd troggle' 'cd ~/expo/troggle'
'uv run django-admin' 'uv run django-admin'
'uv run manage.py check' '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 ## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html

View File

@@ -6,24 +6,27 @@
# Philip Sargent 2022/04/12 # Philip Sargent 2022/04/12
echo "** This copies file to _deploy/wsl/ !" echo "** This copies file to _deploy/wsl/ !"
cd .. cd ..
source .venv/bin/activate
cd troggle cd troggle
echo `pwd` echo `pwd`
echo deprecations. 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. echo diffsettings.
rm diffsettings.txt rm diffsettings.txt
if test -f "diffsettings.txt"; then if test -f "diffsettings.txt"; then
echo "diffsettings.txt not deleted. You have a serious permissions problem. Aborting.." echo "diffsettings.txt not deleted. You have a serious permissions problem. Aborting.."
exit exit
fi fi
python manage.py diffsettings | grep "###" > diffsettings.txt $PYTHON manage.py diffsettings | grep "###" > diffsettings.txt
echo uv pip freeze.
uv pip freeze > requirements.txt
echo inspectdb. echo inspectdb.
# this next line requires database setting to be troggle.sqlite: # 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 #egrep -in "unable|error" troggle-inspectdb.py
echo remove passwords. echo remove passwords.
cp localsettings.py localsettingsWSL.py 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 _deploy/wsl/localsettingsWSL.py _deploy/wsl/localsettingsWSL.py.bak
mv localsettingsWSL.py _deploy/wsl mv localsettingsWSL.py _deploy/wsl
cp *.sh _deploy/wsl cp *.sh _deploy/wsl
deactivate
# #
# Do these before final testing, *not* just before pushing: # Do these before final testing, *not* just before pushing:
# in ./pre-run.sh # in ./pre-run.sh
# python reset-django.py # $PYTHON reset-django.py
# python manage.py makemigrations # $PYTHON manage.py makemigrations
# python manage.py test # $PYTHON manage.py test
# python manage.py inspectdb > troggle-inspectdb.py # $PYTHON manage.py inspectdb > troggle-inspectdb.py
# egrep -i "unable|error" troggle-inspectdb.py # egrep -i "unable|error" troggle-inspectdb.py

View File

@@ -1,32 +1,9 @@
annotated-types==0.6.0 asgiref==3.8.1
asgiref==3.7.2 beautifulsoup4==4.12.3
beautifulsoup4==4.12.0 coverage==7.6.9
black==24.2.0 django==5.1.4
chardet==5.2.0
click==8.1.0
coverage==7.0.0
deptry==0.12.0
django==5.0.4
docutils==0.20
fawltydeps==0.15.0
importlib-metadata==7.0.1
isort==5.13.2
mypy-extensions==1.0.0
packaging==23.0
pathspec==0.12.0
piexif==1.1.3 piexif==1.1.3
pillow==10.2.0 pillow==11.0.0
pip==24.0 soupsieve==2.6
pip-requirements-parser==32.0.1 sqlparse==0.5.3
platformdirs==4.0.0
pydantic==2.6.2
pydantic-core==2.16.3
pyparsing==3.1.1
pytz==2024.1
ruff==0.2.0
setuptools==69.1.0
soupsieve==2.5
sqlparse==0.4.4
typing-extensions==4.9.0
unidecode==1.3.8 unidecode==1.3.8
zipp==3.17.0

42
venv-trog.sh Executable file → Normal file
View File

@@ -1,53 +1,31 @@
#!/bin/bash #!/bin/bash
# now using uv, unbelieveably simpler. # now using uv, unbelieveably simpler.
# Run this in a terminal in the troggle directory: 'bash 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 troggle/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 # 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/ # 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`" echo "-- EXPO folder [current directory]: `pwd`"
TROGDIR=$(cd $(dirname $0) && 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 self update
uv sync 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 # fudge for philip's laptop prior to M2 SSD upgrade
if [ ! -d /mnt/d/EXPO ]; then if [ ! -d /mnt/d/EXPO ]; then
sudo mkdir /mnt/d sudo mkdir /mnt/d
sudo mount -t drvfs D: /mnt/d sudo mount -t drvfs D: /mnt/d
fi fi
if [ -d ${TROGDIR}/../expofiles ]; then uv pip list
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
echo "Django version:`uv run django-admin --version`" echo "Django version:`uv run django-admin --version`"
@@ -55,7 +33,7 @@ echo "### Now do
'[sudo service mysql start]' '[sudo service mysql start]'
'[sudo service mariadb restart]' '[sudo service mariadb restart]'
'[sudo mysql_secure_installation]' '[sudo mysql_secure_installation]'
'cd troggle' 'cd ~/expo/troggle'
'uv run django-admin' 'uv run django-admin'
'uv run manage.py check' '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 ## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html