A simple Task Management API built using Django REST Framework. This API allows users to Create, Read, Update, and Delete (CRUD) tasks.
- List all tasks
- Create a new task
- Retrieve a specific task
- Update an existing task
- Delete a task
- Python (v3.x)
- Django (v4.x)
- Django REST Framework
- PostgreSQL (for database)
- Docker (optional)
git clone git@github.com:PritomKarmokar/taskify.git
cd taskify-apiBefore running the project, copy the .env.example file and update it with your database credentials:
cp .env.example .env📌 Make sure to update the .env file with the correct values!
SECRET_KEY=your-secret-key
DEBUG=True
ALLOWED_HOSTS=127.0.0.1,localhost
# Database Settings
DB_NAME=todo_db
DB_USER=postgres
DB_PASSWORD=postgres
# Change 'DB_HOST' value to 'db' when running docker
DB_HOST=localhost
DB_PORT=5432python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txt python manage.py migratepython manage.py createsuperuserpython manage.py runserverThe API will be available at: http://127.0.0.1:8000
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/tasks/ |
List all tasks |
| POST | /api/tasks/create/ |
Create a new task |
| GET | /api/tasks/retrieve/<task_id>/ |
Retrieve a task |
| PATCH | /api/tasks/update/<task_id>/ |
Update a task |
| DELETE | /api/tasks/delete/<task_id>/ |
Delete a task |
If you want to run this project inside a Docker container, follow these steps:
cp .env.example .env📌 Update your .env file to set database credentials and any other required variables.
docker compose up --builddocker compose run django-web python manage.py migratedocker compose run django-web python manage.py createsuperuserThe API will be available at: http://127.0.0.1:8000
This project includes unit tests to ensure API functionality.
To execute all test cases, run the following command:
python manage.py testIf running inside a Docker container, use:
docker compose run django-web python manage.py testThis project is built to be a fun and practical way to explore Django and its API capabilities. Feel free to clone the repository, experiment with the code, and modify it however you like!