Skip to content

Setup a development environment

Pre requisites


Following tools need to be installed on your workstation:

  • Docker
  • Docker-compose
  • Python 3.8
  • Python virtualenv
  • Poetry
  • npm

System packages

Ubuntu based OS:

sudo apt-get install libmysqlclient-dev


sudo yum install mysql-devel

Start a development environment

The development environment is composed of 4 parts:

  • Docker compose: The Docker compose file is used to deploy all required components such as the database and the message broker
  • Celery worker: The Celery worker is a separated process that receive tasks from the main Django process to be executed asynchronously
  • Celery beat: Celery beat is a periodic task scheduler that send task into the celery worker based on a frequency. This part is used by Squest to check the status of executed Tower job
  • Django built in web server: Integrated web server used only for development purpose. main process of the application that serve the Web Ui and the API

Docker compose

Run the Docker dev env to bring up database, message broker and other required system

docker-compose -f dev-env.docker-compose.yml up

Javascript libraries

Install JS libs (npm need to be installed)

npm install

Python environment

Initializing and installing python libraries with Poetry

poetry install

Go into the python virtual env

poetry shell

Create the database with Django migration script

python migrate

Collect static files

python collectstatic --noinput

Insert default data

python insert_default_data

Celery worker and periodic task scheduler

Run Celery process for async tasks from a new terminal

poetry shell
celery -A service_catalog worker -l info

Run Celery beat for periodic tasks from a new terminal

poetry shell
celery -A service_catalog worker --beat --scheduler django -l info

Django integrated web server

This next command should be executed from your IDE.

Run django dev server

poetry shell
python runserver


To clean all Celery pending tasks

poetry shell
celery -A restapi purge

Execute tests

Run unit tests

poetry shell
python test

Run code coverage

coverage run --source='.' test
coverage report


phpMyAdmin is exposed on localhost:8082.

  • server : db
  • user : root
  • password : p@ssw0rd