This is the source of Mesimä (pronounced Mesi-mah). It is a RESTful HTTP application for task managment, written in Python.
Mesimä was created with ❤️ using Django Rest Framework and PostgreSQL.
Since our Docker image is hosted on Github's container registry, it is possible to run the app using Dokcer, without even cloning the repository.
Note though, that the application will run using sqlite as it's database and not postgres. If you want to run the application using postgres, refer to Development Instructions: Running the Application.
First, create the database file, and store it inside a named volume mesima-data
, using:
docker run -e "DB=sqlite" --volume mesima-data:/backend --entrypoint "python" ghcr.io/amitkummer/mesima:latest manage.py migrate
Then, simply run the app:
docker run -e "DB=sqlite" -it -p 8080:8000 --volume mesima-data:/backend ghcr.io/amitkummer/mesima:latest
Open a web broswer and navigate to https://localhost:8080/api
. You should see DRF's browseable api client.
Running the app requires having tilt, k3d and their dependencies (Docker, kubectl...).
This project was developed using tilt v0.23.4
and k3d v5.2.2
.
Newer version should be fine.
Create a k3d cluster:
$ k3d cluster create --config k3d.yaml
Install Kubegres (a Kuberntes operator for delpoying PostgreSQL clustres):
$ kubectl apply -f https://raw.githubusercontent.com/reactive-tech/kubegres/v1.15/kubegres.yaml
Start the development setup:
$ tilt up
Open a web broswer and navigate to https://localhost:3080/api
. You should see DRF's browseable api client.
To delete the cluster:
$ k3d cluster delete amit-mini-project
It is recommended to run the tests using sqlite, without k3d.
This requires having poetry
installed.
Use the following sequence of commands to run the unit-tests:
$ cd backend
$ poetry install # Install Python dependencies
$ poetry shell # Spawn a shell inside the virtual environemnt
$ cd manager
$ DB="sqlite" python manage.py test # Run the test suite while using sqlite
The Django app and project were generated using django create project
and django create app
commands.
Consequentially, a basic understanding of Django's getting started tutorial should be enough to understand the role of each source file.
To gain understanding of specific aspects of the app (e.g, routing), it is recommended to read the respective source files. DRF abstractions are heavily used for things like serialization, input validation, querying the database safely and more. This allows most code to be self-documenting.
Usage of less common Django/DRF funcitonality is documented inline in each source file, with comments linking to Django documentation.