/sawps

SANBI WPS

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

Image Tag Jenkins Status codecov

🦏 SANBI WPS

The SANBI Wildlife Protection System is a platform to track the population levels of endangered wildlife.

image

The work is funded by the South African National Biodiversity Institute

This project is implemented by Kartoza under contract to IDS.

📒 License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Read the full license.

🧑🏽‍💻 Development

Please follow the Kartoza coding standards.

🏃‍♂️ How To Run Project with Visual Studio Code

Copy and customize environnment file: Create a copy of the deployment/.template.env file and name it deployment/.env. Update the deployment/.env file with your project-specific settings. image

Ensure Dev Containers extension is installed image

Build and open project in devcontainer: press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux) to open the Command Palette. Type Dev Containers: Rebuild and Reopen in Container and select it to reopen the folder inside the devcontainer. image

Change the permissions of the django_project folder:

chmod -R a+rw django_project

Install dependencies inside the container: Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux), type Tasks: Run Tasks and select it. Choose React: Install dependencies to install the necessary dependencies.

image

image

Run the migrations inside the container: Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux), type Tasks: Run Tasks and select it. Choose Django: Migrate.

image

django-migrate

👩‍💻 Open the developer site

Run the project inside the container: Press Cmd+Shift+D (macOS) or Ctrl+Shift+D (Windows/Linux), choose Django+React in the RUN AND DEBUG dropdown.

image

Review the list of forwarded ports from the container to your local host:

forwarded-ports

Open your web browser and go to localhost:8000 to view the running application.

👩‍🏭 Create a super user

django-superuser1

django-superuser2

💽 Restoring layer schema for map

The full dump file for layer schema is ~5.3GB, meanwhile compact dump file is only 24MB.

Download Full Dump File for Layer.

Download Compact Dump File for Layer.

Preview for compact dump file: sanbi_maps_compact

Copy the dump file to db container. Then run pg_restore from inside db container to restore the dump file.

docker cp sanbi_layer_db_compact.dump deployment-db-1:/home/sanbi_layer_db_compact.dump
docker exec -it deployment-db-1 /bin/bash
cd /home
pg_restore -h 127.0.0.1 -U docker -d django -n layer sanbi_layer_db_compact.dump

💻 Resources

Database ERD

Figma Board