Skip to content

tatortrechts/api.tatortrechts.de

Repository files navigation

api.tatortrechts.de

Backend for tatortrechts.de (repo).

Development

./local.sh [--build]

create migrations & migrate database:

./local_manage.sh

import data:

./local_manage.sh importdata /importdata/rechtegewalt.db

reset database and the content:

./local_manage.sh reset_db

access django shell for debugging:

./local_manage.sh shell_plus --print-sql

Restore backup

./local_manage.sh dbrestore

Deployment

The alpine version of postgis does not work together with Dokku. So pull & tag this very specific postgres image when creating the postgres db.

docker pull postgis/postgis:11-3.0
sudo dokku postgres:create apidb -i "postgis/postgis" -I "11-3.0"

Mount these volumes:

To 1) import data and 2) store backups, 3) persist image uploads

/what/ever:/importdata
/what/ever:/backups
/var/nginx/whatever/media:/app/media

Make sure to serve the media files with your nginx.

Scripts:

# updatedata.sh
#!/usr/bin/env bash
set -e
set -x

rm -f data/rechtegewalt.db
wget https://data.tatortrechts.de/rechtegewalt.db -P data
dokku run api ./manage.py importdata /importdata/rechtegewalt.db
# backup.sh
#!/usr/bin/env bash
set -e
set -x

dokku run api bash -c "./manage.py mediabackup --clean && ./manage.py dbbackup --clean"

Environment Varibales

  • SENTRY_DNS
  • NODEBUG=True
  • SECRET_KEY
  • WEB_CONCURRENCY=4

CMS

We are using WagTail as a headless CMS. You need to create pages with the following slugs to make the frontend work:

  • home
  • hintergrund
  • kontakt
  • blog
  • projekte

License

Affero General Public License 3.0