diff --git a/handbook/troggle/troglaptop.html b/handbook/troggle/troglaptop.html index 87049b633..9881130d1 100644 --- a/handbook/troggle/troglaptop.html +++ b/handbook/troggle/troglaptop.html @@ -38,7 +38,8 @@ $ git clone http://expo.survex.com/repositories/troggle/.git This will create ~/expo/troggle/ and get you a copy of the configuration scripts but you need to make them executable before they will work: @@ -100,7 +101,7 @@ which you can read without installing by looking in:

You will run os-trog24.04.sh just once to install all the basics,and you will run venv-trog.sh just once initially.

We have two configurations for the virtual environment: 'dev' which uses the latest python and Django for speed, and 'server' which mimics the versions currently running on the server. [In December 2024 Django is 5 releases ahead of the version on the server (5.1 versus 3.2). Each has a list of ancilliary packages with the appropriate versions in dev.toml and server.toml.] venv-trog.sh deals with all this python-specific stuff, libraries and Django plug-ins. -

os-trog.sh takes a few minutes: it installs the subset of /expofiles/ you need to work with troggle. If you now want to install survex, therion etc. then run os-survey.shas these drag in a huge number of dependencies. +

os-trog.sh takes a few minutes: it installs the subset of /expofiles/ you need to work with troggle. If you now want to install survex, therion etc. then run os-survey.sh, and go away for an hour, as these drag in a huge number of dependencies and installs all of /expofiles/ except the photos and Martin's mapapp.

Why no Docker container?

Yes, it is true that this would greatly speed up on-boarding new programmers. Or podman. @@ -116,20 +117,6 @@ provisioning so that systems are rebuilt cleanly. register a key with the expo server to get git access if you have @@ -159,44 +146,29 @@ confusing and apparently inconsistent behaviour: e.g. you will upload a file but -

Installing python libraries

-XKCD python install +

Installing python, packages and Django

+XKCD python install -

We do not install Django at this point. We will be installing Django in a separate virtual -environment (a 'venv'), not in the main linux system. - +

We do not install Django at the system level using sudo apt install django. We will be installing two variants of Django and python in a separate virtual +environment (a 'venv'); not in the main linux system. The reasons why are indicated in the cartoon to the right and explained in "python dependency management is a dumpster fire".

Installing a venv

-

[We are revising this process. We are now (December 2024) using uv instead of pip, see - "dumpster fire".. DOCUMENTATION HERE NEEDS UPDATING URGENTLY, we do NOT use REQUIREMENTS.TXT - ] -

In order to avoid compatability issues when deploying our code, we should develop using the same libraries that will be used in production of expo.survex.com. Expo.survex.com currently uses python 3.11.2, python 3.12 (standard with Ubuntu 24.04) is backwardly compatable as long as you do not use any new functions it should be fine. Venv allows us to specify which python libraries to use.

-

[We also develop with Django 5 even though the server is still running Django 3.2, but so long as we are carefule, and test code before pushng to the server, this is fine.] -

- -Create and activate the virtual enviroment: -

cd ~/expo
-python3 -m venv venvexpo
-source venvexpo/bin/activate
-
+

To prevent compatibility issues when deploying our code, we test using the same libraries that run on expo.survex.com. In December 2024 expo.survex.com uses Python 3.11.2 and Django 3.2. However on our laptops we develop with Python 3.13 and Django 5 to get plenty of warning of future incompatibilities. Additionally, these newer versions are faster. -Install the python libraries - -

pip install -r requirements.txt
+

Do this: - -

In case you have python version problems with venv, look at the instructions for python3.11 on WSL2. - - -

cd ~/expo
+    
cd ~/expo/troggle
+uv sync
 source .venv/bin/activate
 
-will mean that you can start checking that the development version of the system (Django 5, python 3.13 etc.) is working. +which resolves the dependences for the packages used with the 'dev' (development) configuration, installs anything missing (including python interpreters), and sets up links to the correct versions of python and django. + +

To swap to the server mimic environment, do:

deactivate
@@ -213,8 +185,26 @@ cp dev.toml pyproject.toml
 uv sync
 source .venv/bin/activate
 
-boh of these are extremely quick because they us uv and everything is cached. - +These scripts are extremely quick because they use uv and everything is cached. +The first time you run uv sync it may take a little while as it will install the +appropriate version of python. +
(troggle) philip@Mohawk:~/expo/troggle$ cp dev.toml pyproject.toml
+(troggle) philip@Mohawk:~/expo/troggle$ uv sync
+Using CPython 3.13.1
+Removed virtual environment at: .venv
+Creating virtual environment at: .venv
+Resolved 11 packages in 25ms
+Installed 9 packages in 545ms
+ + asgiref==3.8.1
+ + beautifulsoup4==4.12.3
+ + coverage==7.6.9
+ + django==5.1.4
+ + piexif==1.1.3
+ + pillow==11.0.0
+ + soupsieve==2.6
+ + sqlparse==0.5.3
++ unidecode==1.3.8
+but it's still extremely quick.

do the basic Django health checks

This all checks that the installation has completed properly. @@ -251,7 +241,7 @@ We have at one time made localsettings in /_deploy/ appropriate for

-WARNING: only the WSL and debian variants are current in December 2021. All the others are so old that + WARNING: only the WSL (12/2024) and debian (12/2023) variants are in any way current . All the others are so old that they will need serious work to be useable. Copy what you need from WSL and debian variants of localsettings.py @@ -421,8 +411,13 @@ You will find it very, very useful to see what is going on if you look directly and browse the data in the tables. This is vital when doing Django migrations between Django versions. A light-weight, simple db browser is DB Browser for SQLite. Connecting directly the the MariaDB database with a control panel or workbench gives even more tools and documentation capabilities. See the + troggle server documentation for how to install MariaDB. -

When Ubuntu is running on WSL, it does not use systemctl. So you need specific instructions for installing MariaDB under WSL, +

When Ubuntu was running on WSL1, it did not use systemctl. Now Ubuntu24.04 does ue systemctl so we should be able to use the same configuration as the server.. [untried as yet]. + +

+

Previously..

+

So under WSL1 you needed specific instructions for installing MariaDB under WSL, do what it says in these instructions first (sudo apt install ...etc.):

-

But it still does not work

+

But it still did not work

That is because we need to install the python tools that talk to mariadb. And while it 'will just work' for python3.9, the standard installed on the distro, with python3.10 it is a bit more work. but note that there is a problem with using python 3.10 in that some bits of pip are not correct and you will get a @@ -471,6 +466,7 @@ sudo apt install libmariadbclient-dev pip install mariadb wwhich now has installed mariadb python stuff, but seems to have trashed my django installattion. Hmph. And pip. +

Getting a copy of live javascript libraries