A django REST API app for creating TODO list with Nested Categories
- Category
- Todo
Direct to the project folder directory
Create a virtual environment for python3 using:
python3 -m venv environment_name
Activating a virtual environment:
source environment_name/bin/activate
Below two command will install all the requirements by building the container and run the server:
To build docker compose file in order to create container of required images (make sure you are in directory where docker-compose file exist).
docker-compose build
To setup (activate) the container
docker-compose up
Check server running at http://localhost:8000/ This must be printing: "Todo API App with Nested Categories"
To manage admin interface, we need to open another terminal and use the below mentioned command,
docker exec -it {container_id} python manage.py createsuperuser
Installing all libraries in requirements file inside the virtual environment:
pip3 install -r requirements.txt
To set-up the database:
python3 manage.py makemigrations
python3 manage.py migrate
Running the project on the localhost:
python3 manage.py runserver
Check for running server:
This must be printing: "Todo API App with Nested Categories"
To manage admin interface, we need to create a super user. To create a super user, execute the below command:
docker exec -it {container_id} python manage.py createsuperuser
The server is running now. Head on to the below API endpoints:
/create-category/
params:
{
"name": ""
}
###List Categories
/categories/
/retrieve-category/id/
/update-category/id/
/delete-category/id/
/taskbycategory/{category-name}/
/create-todo/
params:
{
"name": "",
"description": "",
"category": "",
"date_assigned": ""
}
###List Todo
/todos/
/retrieve-todo/{{id}}/
/update-todo/{{id}}/
/delete-todo/{{id}}/
File Based Caching enabled for 60 seconds
Test using:
python3 manage.py test