From 43b42fe27782ca905a643676c3a573b2036b4abe Mon Sep 17 00:00:00 2001 From: Steve Barber Date: Wed, 29 Jan 2025 16:47:34 -0500 Subject: [PATCH 1/2] Fix running a local standalone server from the top-level Makefile. Update dev setup docs. --- Makefile | 8 +++++--- docs/DeveloperSetup.rst | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b4730143..50cbcbe2 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ PYTHON=venv/bin/python PIP_INSTALL=venv/bin/pip install --no-warn-script-location ROOT_ETC=etc DEPLOY_ETC=deploy/etc +APP_ETC=$(DEPLOY_ETC) DBMAINT=dbutil.py # Note: PLANTTRACER_CREDENTIALS must be set @@ -151,13 +152,14 @@ pytest-coverage: $(REQ) run-local: @echo run bottle locally, storing new data in database - $(PY) bottle_app.py --storelocal + cd deploy/app + $(PYTHON) standalone.py --storelocal run-local-demo: @echo run bottle locally in demo mode, using local database - DEMO_MODE=1 $(PY) bottle_app.py --storelocal + DEMO_MODE=1 $(PYTHON) standalone.py --storelocal -DEBUG:=$(PY) bottle_app.py --loglevel DEBUG +DEBUG:=$(PYTHON) standalone.py --loglevel DEBUG debug: make debug-local diff --git a/docs/DeveloperSetup.rst b/docs/DeveloperSetup.rst index fcd32e18..ff84b5d4 100644 --- a/docs/DeveloperSetup.rst +++ b/docs/DeveloperSetup.rst @@ -8,14 +8,16 @@ Requirements and Preparation * Python3.11. Verify that typing 'python' gives you python3.11. If it doesn't, make sure that your PATH is up-to-date. -* HomeBrew. If installing on a MacOS machine, `HomeBrew `_ must be installed prior to performing the steps below. - +* Package installer + * Homebrew. If installing on a MacOS machine, `HomeBrew `_ must be installed prior to performing the steps below. + * Chocolatey. If installing on a Windows machine, the Chocolatey package manager is recommended. + Setup Steps ----------- #. Clone the Plant Tracer webapp into a directory that will be the local repository, for example:: - git clone --recurse-submodules https://github.com/Plant-Tracer/webapp.git webapp + git clone https://github.com/Plant-Tracer/webapp.git webapp #. Change to the local repository directory:: @@ -84,19 +86,19 @@ Running Locally Quick Start .. code-block:: - make run-local # Ctrl-C to quit + PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini make run-local # Ctrl-C to quit #. To run a Plant-Tracer/webapp server process locally, examine the debug-* targets in Makefile. The general form is: .. code-block:: - PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini python bottle_app.py [arguments] + PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini python standalone.py [arguments] #. A specific case: running with movies stored in MySQL rather than S3: .. code-block:: - PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini python bottle_app.py --storelocal + PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini python standalone.py --storelocal #. Another case: running in demo mode, with movies stored in MySQL rather than S3: @@ -104,7 +106,7 @@ Running Locally Quick Start .. code-block:: - PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini DEMO_MODE=1 python bottle_app.py --storelocal + PLANTTRACER_CREDENTIALS=${MY_INI_FILES}/credentials-myconfig.ini DEMO_MODE=1 python standablone.py --storelocal #. Sometimes, it is necessary to manually clear the cookies that Plant-Tracer/webapp creates in a browser. These cookies are of the form "api_key-"+my_database_name. Here is an example: From 8f6516ae9c90222276980fa42ad4fb115ce58831 Mon Sep 17 00:00:00 2001 From: Steve Barber Date: Wed, 29 Jan 2025 16:53:29 -0500 Subject: [PATCH 2/2] don't cd in run-local --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 50cbcbe2..c21fc4cc 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,6 @@ pytest-coverage: $(REQ) run-local: @echo run bottle locally, storing new data in database - cd deploy/app $(PYTHON) standalone.py --storelocal run-local-demo: