Create a .env file in the project root (or set environment variables). Required variables:
LAJI_API_ACCESS_TOKEN(optional): API access token for fetching data from laji.fi (later will implement the use of access_token from laji-auth)LAJI_API_BASE_URL(optional): Base URL for laji.fi API (default: https://api.laji.fi/warehouse/private-query/unit/list)MML_API_KEY(optional): Maanmittauslaitos API key used by the server tile-proxy fortaustakarttaandmaastokartta. Get one: https://omatili.maanmittauslaitos.fi/user/profileTARGET(required for login flow): target (system identifier) parameter sent to laji-auth loginLAJIAUTH_URL(optional): base URL for laji-auth (default: https://fmnh-ws-test-24.it.helsinki.fi/laji-auth/)SECRET_KEY(required): Flask secret key used to sign sessionsSECRET_TIMEOUT_PERIOD(optional): request timeout seconds when contacting laji-auth (default: 10)
The application will load variables from .env automatically. Do not commit secrets.
The app uses PostgreSQL/PostGIS for data storage. Use docker-compose to run both the database and web app:
chmod +x docker-entrypoint.sh
docker-compose up --buildOn first start the entrypoint automatically:
- Creates all tables
- Loads the taxon hierarchy from
static/resources/hierarchy.json - Seeds species from
static/resources/species_and_groups.tsv(includes IUCN 2019 categories) - Generates the Finland base grid
All steps are idempotent — safe to run multiple times.
Access the app at http://localhost:5000/simple
To stop:
docker-compose downTo remove all data (including database):
docker-compose down -vSpecies and their IUCN categories are seeded automatically on startup.
To re-seed manually (e.g. after updating the TSV):
# locally (requires DB port 5432 mapped)
python seed_species.py
# or inside the running container
docker compose exec web python seed_species.pyThe seeder skips existing species and prints a summary of inserted / skipped rows.
If you have an existing deployment that predates the iucn_category / mx_id columns, run the migration first:
oc exec <db-pod> -- psql -U biotools -d biotools \
-f /dev/stdin < migrations/add_iucn_mx_id_to_projects.sqlThen trigger a re-seed:
oc exec <web-pod> -- python seed_species.py