-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
There are a lot of potentially unfamiliar terminology used in this document so it might be helpful to briefly explain some of them.
Django: Django is a Python web application framework that uses traditional server-side scripting. The framework follows Model-view-controller (MVC) design pattern.
Django REST Framework: Django REST Framework is an Django extension with some additional functionality.
Docker: Docker is a tool for bundling applications into images that contains all the libraries and resources that the application needs including a preferred Linux distribution. Dockerfile contains the instructions on how to create an image. These images can be used to created instances called containers that can be started, stopped and removed.
Docker Compose: Docker Compose is a tool for making the management of multiple Docker containers easier. The configuration is stored in a docker-compose.yml file.
PostgreSQL: PostgreSQL is a relational database management system.
The full environment is set up using Docker Compose and consists of two Docker containers:
- web contains Django web server (nicknamed WebMark2)
- db contains PostgreSQL database
On the staging server there is also a third container running Lighttpd to serve static files.
The web server has been nicknamed WebMark2. Folder /webmark2/
contains project settings and /qleader/
contains the actual application.
WebMark2 uses Django REST framework, which uses a model system to construct the database (PostgreSQL) that the application uses. Custom models of WebMark2 can be found from the folder /qleader/models/
, with which the application also uses a bunch of default models offered in Django.
Here is the uml graph of the WebMark2, which corresponds to the database schema (You might need to open the image up in a separate tab to see the small text):
(The instructions on how the image above was generated can be found here)
If you need to access a running server's database, you should first enter the terminal inside the Docker container. Here is an example command, where the database's container is named "qleader-db":
sudo docker exec -it qleader-db /bin/bash
When you are in the container, here is the example command to enter PostgreSQL, when the database user's name is "quantuser" and the database's name is "quantdb":
psql -U quantuser quantdb
In PostgreSQL you can get "help" with the command \?
and for example list all the database tables with \d
. You can see for example the content of a table "auth_user" with TABLE auth_user
. With \x
you can toggle on and off the "extended display" -mode, which allows for easier reading of some large tables (and makes it significantly harder for others).