Skip to content

Development Guide

Alvin Chow edited this page Jan 18, 2021 · 1 revision

Development Guide

Docker

Start/stop all containers

docker-compose up -d -t1
docker-compose down -t1

Restart a container

docker-compose restart <container>
docker-compose restart web -t1

Logs

docker-compose logs -f
docker-compose logs -f web

Rebuild image

docker-compose build

Enter a container

docker-compose exec web bash

CLI commands

manage

There are various commands in here. Feel free to add more.

Shell

Go into the iPython shell. Note that it runs the shell.py script, which auto imports a bunch of things for convenience.

shell

Unit Tests

Run tests

runtests <options>
runtests -vs     # run with stdout/verbose
runtests --create-db    # reset the db

or

./runtests.py 

Working with Database

There are various db commands in the manage db command group Drop database

manage db drop

Create database

manage db create

Reset database schema

manage db reset     # reset DB to latest without migrations
manage db reset --no-tables   # clear tables
manage db reset --migrate     # reset DB to latest with migrations

Run database migrations

manage db migrate
manage db migrate --undo   # revert latest migration

Seed database

manage seed local --reset-db

Database Migrations

Make a migration

manage db makemigration -m "foo"

This will make an Alembic migration file in alembic/versions. Inspect it and then check it in.

Note that if someone checks in a new migration file at the same time you'll need to update the down_revision dependency.

Override App Config

Make a local_config.py file at the root. Add Python variables with the same name as ones in app/config.py to override.

e.g.

CSRF_ENABLED = False
Clone this wiki locally