2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-12-18 06:22:18 +00:00
troggle/venv-trog.sh

75 lines
2.2 KiB
Bash
Raw Normal View History

2024-12-12 00:38:28 +00:00
#!/bin/bash
2024-12-12 01:26:36 +00:00
# now using uv, unbelieveably simpler.
2024-12-12 00:38:28 +00:00
# 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"'
# Expects an Ubuntu 22.04 with all the gubbins already installed
# If you have not already installed these on your clean Ubuntu install DO THIS FIRST
2024-12-12 01:26:36 +00:00
# use the script os-trog24.04.sh runniing it in /home/username/
2024-12-12 00:38:28 +00:00
python --version
echo "-- EXPO folder [current directory]: `pwd`"
TROGDIR=$(cd $(dirname $0) && pwd)
echo "-- Troggle folder [this script location]: ${TROGDIR}"
cp troggle/pyproject.toml .
uv self update
uv sync
exit 1
# this next is a bit wordy
# uv python list --only-installed
2024-12-12 01:26:36 +00:00
# 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
2024-12-12 00:38:28 +00:00
#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 ..."
2024-12-12 01:26:36 +00:00
PIP="uv pip"
2024-12-12 00:38:28 +00:00
2024-12-12 01:26:36 +00:00
REQUIRE="requirements.txt"
2024-12-12 00:38:28 +00:00
$PIP freeze > $REQUIRE
2024-12-12 01:26:36 +00:00
$PIP list
2024-12-12 00:38:28 +00:00
2024-12-12 01:26:36 +00:00
echo "Django version:`uv run django-admin --version`"
2024-12-12 00:38:28 +00:00
echo "### Now do
'[sudo service mysql start]'
'[sudo service mariadb restart]'
'[sudo mysql_secure_installation]'
'cd troggle'
2024-12-12 01:26:36 +00:00
'uv run django-admin'
'uv run manage.py check'
2024-12-12 00:38:28 +00:00
## 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
2024-12-12 01:26:36 +00:00
'uv run manage.py test -v 2'
2024-12-12 00:38:28 +00:00
'./pre-run.sh' (runs the tests again)
2024-12-12 01:26:36 +00:00
'uv run databaseReset.py reset INIT'
'uv run manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)'
2024-12-12 00:38:28 +00:00
"
# if [ ! -d /mnt/d/expofiles ]; then
# echo '### No valid expofiles directory on /mnt/d . Fix this before any tests will work.'
# fi