Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running a local standalone server #651

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -151,13 +152,13 @@ pytest-coverage: $(REQ)

run-local:
@echo run bottle locally, storing new data in database
$(PY) bottle_app.py --storelocal
$(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

Expand Down
16 changes: 9 additions & 7 deletions docs/DeveloperSetup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://brew.sh>`_ must be installed prior to performing the steps below.

* Package installer
* Homebrew. If installing on a MacOS machine, `HomeBrew <https://brew.sh>`_ 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::

Expand Down Expand Up @@ -84,27 +86,27 @@ 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:

* Note: there must be no user logged in for demo mode to take effect. May have to clear browser cookies.

.. 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:

Expand Down