Skip to content

Repository files navigation

βœ… Task Manager - Django Web Application

A full-featured task management web application built with Django, PostgreSQL, Redis, and Docker.

Python Django PostgreSQL Redis Docker CI Tests Coverage

🎯 Project Overview

A clean, production-ready task manager with user authentication, task filtering, tagging system, and dark mode. Built as a portfolio project demonstrating Django best practices, Docker infrastructure, CI/CD pipeline, and background task processing with Celery.

✨ Features

Tasks

  • βœ… Create, edit, and delete tasks with priorities, statuses, and deadlines
  • βœ… Set priority (Low / Medium / High)
  • βœ… Track status (To Do / In Progress / Done)
  • βœ… Filter tasks by status, priority, tag, and search by title
  • βœ… Sort tasks by date, deadline, or priority
  • βœ… Set deadlines with overdue highlighting
  • βœ… Tag system with Select2 autocomplete
  • βœ… Email reminders for upcoming deadlines (via Celery)
  • βœ… Pagination (9 tasks per page)

Users

  • βœ… Registration with auto-login
  • βœ… Custom User model (AbstractUser)
  • βœ… Each user sees only their own tasks
  • βœ… Protection against accessing other users' tasks (404)

UI

  • βœ… Responsive Bootstrap 5 interface
  • βœ… Dark mode with localStorage persistence
  • βœ… Success/error notifications (Django messages)
  • βœ… Admin panel

πŸ› οΈ Tech Stack

Backend

  • Django 5.2 - Web framework
  • PostgreSQL 16 - Primary database
  • Redis 7 - Cache & Celery broker
  • Celery + django-celery-beat - Background tasks & scheduling
  • django-filter - Declarative filtering and ordering
  • Gunicorn - WSGI server
  • Whitenoise - Static files serving
  • python-decouple - Environment configuration

Frontend

  • Bootstrap 5.3 - UI framework
  • Select2 4.1 - Tag autocomplete
  • Font Awesome 6 - Icons

Infrastructure

  • Docker & Docker Compose - Containerization (5 services)
  • GitHub Actions - CI/CD pipeline (lint + test + coverage)
  • pre-commit - Automated code quality hooks

Testing & Quality

  • pytest + pytest-django - Test framework
  • coverage - Code coverage (95%)
  • black - Code formatter
  • isort - Import sorter
  • flake8 - Linter

πŸš€ Getting Started

Prerequisites

  • Docker & Docker Compose
  • Python 3.12+

Installation

  1. Clone the repository:
git clone https://github.com/egorpusto/task-manager.git
cd task-manager
  1. Create .env file:
cp .env.example .env
  1. Edit .env with your values:
SECRET_KEY=your-secret-key
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1

DB_NAME=task_manager_db
DB_USER=task_manager_user
DB_PASSWORD=yourpassword
DB_HOST=localhost
DB_PORT=5432

REDIS_URL=redis://127.0.0.1:6379/1

EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
  1. Start PostgreSQL and Redis:
docker compose up db redis -d
  1. Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
  1. Run migrations:
python manage.py migrate
python manage.py setup_periodic_tasks
  1. Create superuser:
python manage.py createsuperuser
  1. Run the development server:
python manage.py runserver

Open http://127.0.0.1:8000

Run with Docker (full stack)

docker compose up -build

πŸ§ͺ Testing

# Run tests with coverage
pytest -cov=tasks -cov=accounts

# Run pre-commit hooks manually
pre-commit run -all-files

Test Coverage - 95%

Module Coverage
accounts/ 100%
tasks/models.py 100%
tasks/views.py 100%
tasks/filters.py 100%
tasks/forms.py 100%
tasks/tasks.py 100%
Total 95%

Test Suite - 25 tests

Class Tests
TestTagModel 2
TestTaskModel 7
TestTaskListView 3
TestTaskCreateView 1
TestTaskUpdateView 2
TestTaskDeleteView 2
TestTaskFilterView 3
TestSendDeadlineReminders 4
TestSignUpView 1
Total 25

πŸ”„ CI/CD Pipeline

Every push and pull request to main triggers:

βœ… Lint - black, isort, flake8 βœ… Tests - Full pytest suite with PostgreSQL and Redis services βœ… Coverage - Report artifact uploaded on every run

🐳 Docker Services

Service Image Port
web Custom (Django + Gunicorn) 8000
db postgres:16-alpine 5432
redis redis:7-alpine 6379
celery_worker Custom (Celery worker) -
celery_beat Custom (Celery scheduler) -

Useful Commands

# Start all services
docker compose up -d

# View logs
docker compose logs -f web

# Stop all services
docker compose down

# Remove volumes (reset database)
docker compose down -v

# Run Celery worker locally
celery -A task_manager worker --loglevel=info

# Trigger deadline reminders manually
python manage.py shell -c "from tasks.tasks import send_deadline_reminders; send_deadline_reminders.delay()"

πŸ—„οΈ Database Schema

Task

- id: BigInteger (Primary Key)
- user: ForeignKey β†’ accounts.User
- title: VARCHAR(200)
- description: TEXT
- priority: VARCHAR(10) [low, medium, high]
- status: VARCHAR(20) [todo, in_progress, done]
- deadline: TIMESTAMP (nullable)
- tags: ManyToMany β†’ Tag
- created_at: TIMESTAMP
- updated_at: TIMESTAMP

Tag

- id: BigInteger (Primary Key)
- name: VARCHAR(50) UNIQUE

User (custom)

- Extends Django AbstractUser
- Ready for future profile extensions (avatar, timezone, bio)

πŸ—οΈ Project Structure

task_manager/
β”œβ”€β”€ manage.py
β”œβ”€β”€ task_manager/               # Django project config
β”‚   β”œβ”€β”€ settings.py
β”‚   β”œβ”€β”€ urls.py
β”‚   β”œβ”€β”€ wsgi.py
β”‚   β”œβ”€β”€ asgi.py
β”‚   └── celery_app.py           # Celery configuration
β”œβ”€β”€ accounts/                   # Custom user app
β”‚   β”œβ”€β”€ models.py               # AbstractUser
β”‚   β”œβ”€β”€ forms.py                # CustomUserCreationForm
    β”œβ”€β”€ apps.py
β”‚   └── admin.py
β”œβ”€β”€ tasks/                      # Main application
β”‚   β”œβ”€β”€ migrations/
β”‚   β”œβ”€β”€ management/
β”‚   β”‚   └── commands/
β”‚   β”‚       └── setup_periodic_tasks.py
β”‚   β”œβ”€β”€ static/tasks/css/
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   β”œβ”€β”€ base.html
β”‚   β”‚   β”œβ”€β”€ 404.html
β”‚   β”‚   β”œβ”€β”€ registration/
β”‚   β”‚   └── tasks/
β”‚   β”œβ”€β”€ models.py               # Task, Tag with TextChoices
β”‚   β”œβ”€β”€ views.py
    β”œβ”€β”€ apps.py
β”‚   β”œβ”€β”€ forms.py
β”‚   β”œβ”€β”€ filters.py              # django-filter TaskFilter
β”‚   β”œβ”€β”€ tasks.py                # Celery tasks
β”‚   β”œβ”€β”€ urls.py
β”‚   β”œβ”€β”€ admin.py
β”‚   └── tests.py                # 25 pytest tests
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ pyproject.toml              # black, isort, pytest, coverage config
β”œβ”€β”€ .pre-commit-config.yaml
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ dockerfile
β”œβ”€β”€ .env.example
└── .github/workflows/ci.yml

πŸ”’ Security

  • CSRF protection - All forms protected
  • Login required - All task views require authentication
  • Object-level protection - Users can only access their own tasks (404 on foreign objects)
  • Custom User model - Ready for production from day one
  • Environment variables - Secrets never hardcoded
  • Password validation - Django built-in validators

πŸ“Έ Screenshots

Task List Task List (Night theme) Add Task Edit Task (Night theme)
Task List Task List (Night theme) Add Task Edit Task (Night theme)

πŸ‘€ Author

Egor Pusto

πŸ“„ License

This project is for educational purposes.

About

Task management web app built with Django, PostgreSQL, Redis and Docker

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages