Skip to content

DevKing0417/Task_manage_app_Python-Django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Manager

A simple Django-based task management application with user authentication, PostgreSQL database, and Docker containerization.

Overview

This application was developed as part of a technical assessment to demonstrate full-stack development skills. It provides a complete task management system where users can create, view, update, and delete their tasks. Each user can only access their own tasks, ensuring data privacy and security.

Features

  • User registration and authentication
  • CRUD operations for tasks (Create, Read, Update, Delete)
  • Task filtering by status
  • Responsive design with Tailwind CSS
  • RESTful API with Swagger documentation
  • Docker containerization with separate services for Django, PostgreSQL, and Nginx

Tech Stack

  • Backend: Django 4.2
  • Database: PostgreSQL 14
  • Frontend: Tailwind CSS
  • API: Django REST Framework
  • Documentation: drf-yasg (Swagger)
  • Containerization: Docker & Docker Compose
  • Testing: pytest & Django Test Framework

Interactive Documentation

Interactive API documentation is available at /api/swagger/ when the application is running. This provides a user-friendly interface to explore and test all API endpoints.

Application Screenshots

Sign In

Sign In Screen

Create Account

Create Account Screen

My Tasks

My Tasks Dashboard

My Tasks with Existing Tasks

My Tasks with Existing Tasks

Create New Task

Create New Task Screen

Task Details

Task Details View

Edit Task

Edit Task Screen

Delete Task

Delete Task Confirmation

Swagger Documentation

Swagger Documentation

Quick Setup with Makefile

Prerequisites

  • Docker and Docker Compose installed on your system

First-Time Setup

For first-time setup, use the following commands:

# Clone the repository
git clone https://github.com/climax-coder/simple-django-tasks-app
cd task-manager

# Set up and start the application (builds containers, runs migrations, and starts services)
make setup

This command will:

  1. Build all Docker containers
  2. Start the application services
  3. Run database migrations
  4. Set up initial configuration

Creating an Admin User

After the setup is complete, create an admin user to access the admin interface:

make createsuperuser

Follow the prompts to create your admin account. the default password is password.

Day-to-Day Development Commands

After the initial setup, use these commands for day-to-day development and maintenance:

# Start the application (if it's not already running)
make up

# Stop the application
make down

# Restart the application (after code changes)
make restart

# View real-time logs
make logs

# Run API tests
make test

# Run database migrations (after model changes)
make migrate

# Access Django shell for debugging
make shell

# Clean up all containers and volumes (complete reset)
make clean

For a full list of available commands:

make help

Development Workflow

  1. Make code changes
  2. Use make restart to apply changes
  3. Use make logs to check for errors
  4. Use make test to run tests and verify functionality
  5. Repeat as needed

Access the Application

Manual Setup

If you prefer not to use the Makefile, you can run the commands directly:

  1. Build and start the containers:

    docker compose build
    docker compose up -d
  2. Run migrations:

    docker compose exec web python manage.py migrate
  3. Create a superuser (admin) account:

    docker compose exec web python manage.py createsuperuser

Development Setup

If you want to run the application in development mode without Docker:

  1. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies:

    cd task_manager
    pip install -r requirements.txt
  3. Set up environment variables (copy .env.example to .env and modify as needed)

  4. Run migrations and start the server:

    python manage.py migrate
    python manage.py runserver

API Documentation

Authentication

The API uses token-based authentication. Include the token in the Authorization header:

Authorization: Token <your-token>

API Endpoints

The application provides a RESTful API for task management:

Endpoint Method Description Request Body Response
/api/tasks/ GET List all tasks for the authenticated user - Array of task objects
/api/tasks/ POST Create a new task Task object Created task object
/api/tasks/{id}/ GET Retrieve a specific task - Task object
/api/tasks/{id}/ PUT Update a specific task Task object Updated task object
/api/tasks/{id}/ DELETE Delete a specific task - 204 No Content

Task Object Structure

{
  "id": 1,
  "title": "Task Title",
  "description": "Task description",
  "status": "pending", // Options: pending, in_progress, completed
  "due_date": "2025-06-01",
  "created_at": "2025-05-01T12:00:00Z",
  "updated_at": "2025-05-01T12:00:00Z"
}

Project Structure and Architecture

Directory Structure

task_manager/
├── apps/
│   └── tasks/            # Tasks application with models, views, and API
│       ├── api.py        # API viewsets and permissions
│       ├── forms.py      # Form definitions for task creation/editing
│       ├── models.py     # Task data model
│       ├── serializers.py # API serializers
│       ├── tests.py      # Model and view tests
│       ├── test_api.py   # API endpoint tests
│       ├── urls.py       # URL routing for task views
│       └── views.py      # View controllers
├── task_manager/         # Project configuration
│   ├── settings.py       # Django settings
│   ├── urls.py           # Main URL routing
│   └── wsgi.py           # WSGI configuration
├── templates/            # HTML templates
│   ├── base.html         # Base template with common layout
│   └── tasks/            # Task-specific templates
├── static/               # Static files (CSS, JS, images)
├── theme/                # Tailwind CSS configuration
├── Dockerfile            # Docker configuration for Django app
├── requirements.txt      # Python dependencies
└── manage.py             # Django management script

nginx/                    # Nginx configuration
├── nginx.conf           # Nginx server configuration
docker-compose.yml        # Docker Compose services definition
.env                      # Environment variables
Makefile                  # Easy setup and management commands

Architecture

This application follows a modern web application architecture with:

  1. Three-Tier Architecture:

    • Presentation Layer: Django templates with Tailwind CSS
    • Application Layer: Django views and REST API
    • Data Layer: PostgreSQL database
  2. Containerization:

    • Web Container: Django application server
    • Database Container: PostgreSQL database
    • Proxy Container: Nginx for serving static files and reverse proxy
  3. API Architecture:

    • RESTful API using Django REST Framework
    • JWT-based authentication
    • Swagger/OpenAPI documentation

Approach and Design Decisions

This project was built with a focus on:

  1. Clean, maintainable code structure:

    • Modular application design with separation of concerns
    • Clear naming conventions and code organization
    • Comprehensive docstrings and comments
  2. Secure user authentication:

    • Django's built-in authentication system
    • Permission-based access control
    • User isolation (users can only access their own tasks)
  3. Responsive UI with modern design:

    • Tailwind CSS for utility-first styling
    • Mobile-first responsive design
    • Clean, intuitive user interface
  4. Comprehensive API with documentation:

    • RESTful API design principles
    • Swagger/OpenAPI documentation
    • Proper error handling and status codes
  5. Easy deployment with Docker:

    • Multi-container setup with Docker Compose
    • Environment variable configuration
    • Production-ready settings
  6. Test coverage for critical functionality:

    • Unit tests for models and views
    • API endpoint tests
    • Authentication and permission tests

Key Design Patterns

  • Model-View-Template (MVT): Following Django's core design pattern
  • Repository Pattern: Encapsulating data access logic in the models
  • Service Layer: Business logic separated from views
  • Permission Classes: Custom permission handling for API access

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published