Sancer / auditlog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

This repository is an example of how we can collect changes on our models and query those changes through an api.

For large volumes of data it is better to use a persistence system designed for this use case:

  • If you usually look at the logs, Elasticseach with a combination of tier warm for daily writes and another freeze for storage and long term reads for example.
  • If data is consumed very infrequently and queries do aggregations/metrics, BigQuery is a good choice.

Index

Setup local

Copy envfile

cp .env.example .env

Dependencies

pip install -r requirements.txt

Prepare database

python manage.py migrate 

Create superuser

Follow the instructions in the shell

python manage.py createsuperuser 

Start local web server

python manage.py runserver 

Play

For more information about the api, please refer to the automatically generated documentation.

Containers

Docker

Build

docker build -t auditlog .

Docker Compose

Build

docker compose build

Start all

docker compose build

Run migrations

docker-compose exec api python manage.py migrate --noinput

Run tests

docker compose -f docker-compose.yml -f docker-compose.test.yml run api

About


Languages

Language:Python 99.5%Language:Dockerfile 0.5%