Django and Leaflet application that collects tracking information using IMAP from a mailbox and displays it on a collection of layers provided by Geoserver. The application also downloads observation data from automatic weather stations.
The recommended way to set up this project for development is using Poetry to install and manage a virtual Python environment. With Poetry installed, change into the project directory and run:
poetry install
To run Python commands in the virtualenv, thereafter run them like so:
poetry run python manage.py
Manage new or updating project dependencies with Poetry also, like so:
poetry add newpackage==1.0
This project uses confy to set environment variables (in a .env
file).
The following variables are required for the project to run:
DATABASE_URL="postgis://USER:PASSWORD@HOST:PORT/DATABASE_NAME"
SECRET_KEY="ThisIsASecretKey"
Other environment variables will be required to run the project in production (these are context-dependent).
Use runserver
to run a local copy of the application:
poetry run python manage.py runserver 0:8080
Run console commands manually:
poetry run python manage.py shell_plus
Run unit tests like so:
poetry run python manage.py test --keepdb -v2
To build a new Docker image from the Dockerfile
:
docker image build -t ghcr.io/dbca-wa/resource_tracking .
This project includes the following pre-commit hooks:
Pre-commit hooks may have additional system dependencies to run. Optionally install pre-commit hooks locally like so:
poetry run pre-commit install
Reference: https://pre-commit.com/