Simple Todo List where you can create tasks, check them as done, edit the description and delete them. This project was made with React, Django, MySql and Docker.
As we use Docker there´s the advantage that everything you need to run this project is Docker
. There are two separate containers one for the backend and one for the frontend. To run both I used Docker-Compose
.
docker-compose up --build
- This command will up the two 'services' defined in the
docker-compose.yml
file.
The API is running on the port 8000 in localhost. And the frontend is running on a nginx so the default port is 80.
Besides the default tables that django creates the tables added with the models created are the following ones:
Create
- This endpoint is for creating a new task
POST: /api/task/tasks
body: {
description: "Testing the API",
status: false,
tags: [1] #optional, #This field can be sended as an empty array
}
List
- This endpoint is for list all the tasks created with their tags associated
GET: /api/task/tasks
Update
- This endpoint is for updating certain fields of the task (status, description, tags)
PATCH: /api/task/tasks/:id
{
status: true
}
Delete
- This endpoint is for deleting a task
DELETE /api/task/tasks/:id
To follow the python standard I used a package named flake8
which check your code for identation, spaces, comments, length of a line, etc.
Also I try to follow TDD which is in generally words to make a test first and then create the code to that test pass.
-
To start django project
django-admin startproject app .
-
To create a module
python manage.py startapp core
-
For migrations
python manage.py makemigrations core python manage.py migrate
-
To run the server
python manage.py runserver 0.0.0.0:8000
Screen.Recording.2022-04-26.at.08.10.53.mov
- Django
- djangorestframework
- flake8
- django-cors-headers
- mysqlclient
- React
- Docker and docker-compose
- Mysql
- https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/
- https://docs.djangoproject.com/en/2.1/ref/models/fields/#django.db.models.ManyToManyField
- https://docs.djangoproject.com/en/1.8/ref/django-admin/
- https://realpython.com/django-migrations-a-primer/
- https://testdriven.io/blog/drf-views-part-1/