Skip to content

cholarajaa/fantastic-guacamole

Repository files navigation

Django Notification System

A Django-based notification system with Celery for scheduled task processing and REST API endpoints.

Features

  • Django 5.0 web framework
  • Django REST Framework for API endpoints
  • Celery 5.4 for asynchronous task processing
  • Redis message broker
  • MySQL database support
  • Comprehensive test suite with 34+ tests
  • Docker containerization support

Quick Start

Prerequisites

  • Python 3.12+
  • Redis server
  • MySQL database (or SQLite for development)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd fantastic-guacamole
  2. Set up virtual environment

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

    pip install -r requirements.txt
  4. Configure database (update notifier/settings.py if needed)

  5. Run migrations

    python manage.py migrate
  6. Start Redis server

    redis-server
  7. Start Celery worker (in separate terminal)

    source venv/bin/activate
    celery -A notifier worker --loglevel=info
  8. Run development server

    python manage.py runserver

Docker Setup (Alternative)

Prerequisites

If you encounter "permission denied" errors with Docker, run:

./docker-setup.sh

Or manually set:

export DOCKER_HOST=unix:///var/run/docker.sock

Using Docker Compose

  1. Build and start services

    docker-compose build
    docker-compose up
  2. Run migrations (in separate terminal)

    docker-compose run web python manage.py migrate
  3. Access the application

Testing

Run all tests

# Using pytest (recommended)
./test.sh

# Or manually
source venv/bin/activate
DJANGO_SETTINGS_MODULE=notifier.settings_testing python -m pytest -v

# Using Django test runner
python run_tests.py

Test Coverage

  • Models: Validation, business logic, database operations
  • Views: API endpoints, error handling, authentication
  • Serializers: Data serialization/deserialization
  • Tasks: Celery task execution
  • Integration: End-to-end workflows

API Endpoints

  • GET /users/ - List all users
  • POST /notifications/ - Create new notification
  • GET / - Index page

Example API Usage

# Create a notification
curl -X POST http://localhost:8000/notifications/ \
  -H "Content-Type: application/json" \
  -d '{
    "header": "Test notification header with sufficient length",
    "content": "Test notification content with sufficient length", 
    "image_url": "https://example.com/image.jpg",
    "dispatch_time": "2024-12-31T23:59:59Z",
    "user_ids": [1, 2, 3]
  }'

Project Structure

fantastic-guacamole/
├── notification/           # Main app
│   ├── models.py          # Notification model
│   ├── views.py           # API views
│   ├── serializers.py     # DRF serializers
│   ├── tasks.py           # Celery tasks
│   └── tests/             # Test suite
├── notifier/              # Django project
│   ├── settings.py        # Main settings
│   ├── settings_testing.py # Test settings
│   └── celery.py          # Celery configuration
├── static/                # Static files
├── requirements.txt       # Python dependencies
└── docker-compose.yml     # Docker configuration

Upgrade Notes

This project has been upgraded from Django 1.10 to Django 5.0. See UPGRADE_NOTES.md for detailed information about:

  • Dependency upgrades
  • Code modernization changes
  • Breaking changes and migration steps
  • New features and improvements

Resources

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

License

This project is open source and available under the MIT License.

About

Notification creation dashboard and scheduler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •