Documentation

Documentation

  • Website
  • Infrastructure
  • Utils

›Website

Website

  • Frontend
  • Backend

Infrastruktur

  • Servers
  • Docker
  • CircleCi
  • Backup

Utils

  • Voucher
  • Slack bot
  • Scripts
  • Interest-form

Backend

Documentation for the backend section of itDAGENE. This involves the GraphQL API for itdagene.no and the admin interface for admin.itdagene.no

API and admin interface for itdagene.no & admin.itdagene.no

GraphQL API

https://itdagene.no/graphql

TL;DR

  • GraphQL API with django-graphene
  • Python 3.7 with Django
  • Postgres for persistant storage
  • Celery (with redis-broker) for async tasks
  • CircleCI for continuous integration
  • yarn and webpack for admin panel

Setup

First make sure that you have the following software installed on your system:

  • Python 3.7
  • Node.js and yarn
  • docker together with docker-compose

Setup python environment

# Create a new venv and activate it
$ python3 -m venv venv
$ source venv/bin/activate

# Install the base requirements and import settings
$ pip install -r requirements/base.txt
$ echo "from itdagene.settings.dev import *" > itdagene/settings/local.py

Setup the admin interface

# Install all dependensies in the project
$ yarn
# Start the server
$ yarn build

Starting the app

# Start all docker containers for the project
$ docker-compose up -d

# Activate the venv. You need to do this every time your terminal restarts.
$ source venv/bin/activate

# Run the django server
$ python manage.py runserver

Migrations

In order to setup a new dev environment you have to create a superuser. Every time there are new migrations, you have to apply them. If you don't, the runserver command will give you a warning.

$ python manage.py migrate
$ python manage.py createsuperuser

Model changes

Have you changed a model? Then you have to make and apply migrations. Migrations should always be committed to the repo in the same commit/PR as the model change.

$ python manage.py makemigrations
$ python manage.py migrate

Testing

In order to execute the tests, you have to install tox. The tests are always run in the continuous integration server, and no code that doesn't pass all the tests (including linting) should not be merged into the master branch.

$ pip install tox
$ tox

Code style

We enforce the style guide PEP 8 with flake8, and isort for import sorting. yapf is used for code formatting.

$ isort -rc itdagene               # Fix isort errors
$ yapf -ir itdagene                # Fix code formatting
$ tox -e isort -e flake8 -e yapf   # Verify code style

Celery

$ celery worker -A itdagene # worker
$ celery beat -A itdagene   # beat
$ celery flower -A itdagene --address="127.0.0.1" --port=5555 # flower

Misc

Nice reads

  • Terminal intro
  • Django intro
  • Intro to celery
  • Why docker
← FrontendServers →
  • GraphQL API
  • TL;DR
  • Setup
  • Starting the app
  • Migrations
  • Testing
    • Code style
  • Celery
  • Misc
    • Nice reads
Documentation
Docs
Check out how the website is build.Learn about the development operations.Explore other services
More
Admin panelWebapp
Backend
Copyright © 2025 itDAGENE