Skip to content

opendata-apps/mantis

Repository files navigation

Header Banner

An interactive web application to track Mantis Religiosa sightings in Brandenburg, presented by the Naturkundemuseum Potsdam.

Mantis Tracker allows users to report Mantis Religiosa sightings and view them on an interactive map, along with insightful statistics and helpful FAQs.

🌟 Features

  • πŸ“š Learn about the Mantis Religiosa
  • 🎨 Beautiful UI
  • πŸ“ Report mantis sightings with an easy-to-use form
  • πŸ—ΊοΈ View all mantis sightings on an interactive map
  • πŸ“Š View insightful statistics and FAQs

πŸš€ Roadmap

Here are some of the features we plan to add in the future:

  • Gallery of photos of the Mantis Religiosa
  • Improved data visualization and analysis of the sighting data
  • More animations and UI improvements to make the app more engaging
  • Improved performance and code quality

Stay tuned for updates on these exciting new features!

πŸ› οΈ Technologies

HTML CSS Jinja2s Python Flask PostgreSQL Tailwind CSS JavaScript

πŸ’» Development Setup

Prerequisites

  • Python 3.8+
  • Node.js and npm
  • PostgreSQL

Step 1: πŸ“ Clone the repository

git clone https://gitlab.com/opendata-apps/mantis.git
cd mantis

Step 2: 🌐 Create and activate virtual environment

python -m venv .venv
source .venv/bin/activate    # For Windows: .venv\Scripts\activate

Step 3: πŸ“¦ Install Python dependencies

pip install -r requirements.txt

Step 4: πŸ—„οΈ Set up PostgreSQL database

Using psql:

psql -U postgres

Preapare a database for production.

CREATE USER mantis_user WITH PASSWORD 'mantis';
CREATE DATABASE mantis_tracker OWNER mantis_user;
GRANT ALL PRIVILEGES ON DATABASE mantis_tracker TO mantis_user;
-- MacOS only:
GRANT usage, create ON SCHEMA public TO mantis_tracker;
\q

Prepare a database for pytest

CREATE DATABASE mantis_tester OWNER mantis_user;
GRANT ALL PRIVILEGES ON DATABASE mantis_tester TO mantis_user;
-- MacOS only:
GRANT usage, create ON SCHEMA public TO mantis_tester;
\q

Step 5: πŸ—οΈ Create the database tables

flask db upgrade

# aktuelle Version anzeigen
flask db current

# History anzeigen

flask db history

Step 6: β˜• Fill the database tables

If TESTING in config.py is set to TRUE also Demodata are inserted into the database.

flask insert-initial-data

Step 7: 🎨 Run the CSS watcher

cd app/static
npm install

The project includes a convenient script to watch for CSS changes. Start it with:

npm run watch:css

Step 8: πŸš€ Run the application

Development server

python run.py

Step 9: πŸš€ Connect as Reviewer

http://loclahost:5000/reviewer/9999

Start with fresh databases

  • delete database mantis_tracker
  • delete database mantis_tester
  • start again with Step 4

Production setup

  • Edit Settings in app/config.py and make changes e.g.
    • Connectionstring for DB
    • TESTING = False
    • Run Tests with pytest
  • Create the minified CSS file
cd app/static
npm run build:css

Step 9: 🏒 Run production server

gunicorn run:app    # For Windows: waitress-serve --listen=*:8000 run:app

Step 8: 🌐 Access the application

Open http://localhost:5000 in your browser.

Packages

No packages published

Contributors 11