luftdaten-at / datahub

Open source data management system for air quality and environmental data. Used for citizen science and STEM education. Build in Django / PostgreSQL.
https://datahub.luftdaten.at
GNU Affero General Public License v3.0
0 stars 0 forks source link
citizen-science data-management-system django docker

luftdaten-datahub

About luftdaten-datahub

luftaten-datahub is an open source plattform build on the Django Web Framework. It is an citizen science tool to explore air quality data measured by Luftdaten.at devices and other sources.

Documentation

Development

Development version:

docker compose up -d
docker compose exec web python manage.py migrate
docker compose exec web python manage.py createsuperuser

open in web browser: http://localhost

Create migrations after doing changes at the data models:

docker compose exec web python manage.py makemigrations

Changes to the database:

docker compose exec web python manage.py shell
>> from {app_name}.models import {model_name}
>> {model_name}.objects.all().delete()

Testing

Run the unit tests. docker compose exec web python manage.py test docker compose logs

There are https-tests in the /test folder which can be run with the Visual Studio Code Extension REST Client.

Versions

Templates and static files

All template files are in the folder /code/templates _base.html is the base template with different blocks. home.html can be used as an example on how to use the blocks.

Static files like css, js and images are in the folder /code/static.

Admin

The admin login can be found unter /backend.

Translation to German

Run the following command in your project directory:

docker compose exec web python manage.py makemessages -l de

This scans your project for strings marked for translation and creates a django.po file in the locale/de/LC_MESSAGES directory.

Open the django.po file, find your strings, and add the German translation.

docker compose exec web python manage.py compilemessages

Production

Collect static files as preparation.

docker compose exec web python manage.py collectstatic

Build and push to Dockerhub.

docker build -f Dockerfile.prod -t luftdaten/datahub:tagname --platform linux/amd64 .
docker push luftdaten/datahub:tagname

Create docker-compose.prod.yml from example-docker-compose.prod.yml by setting the secret key. Then run:

docker compose -f docker-compose.prod.yml up -d 

API Documentation

Open API Standard 3.1

/api/docs https://datahub.luftdaten.at/api/docs

License

This project is licensed under GNU General Public License v3.0.