A Django-based notification system with Celery for scheduled task processing and REST API endpoints.
- 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
- Python 3.12+
- Redis server
- MySQL database (or SQLite for development)
-
Clone the repository
git clone <repository-url> cd fantastic-guacamole
-
Set up virtual environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure database (update
notifier/settings.pyif needed) -
Run migrations
python manage.py migrate
-
Start Redis server
redis-server
-
Start Celery worker (in separate terminal)
source venv/bin/activate celery -A notifier worker --loglevel=info -
Run development server
python manage.py runserver
If you encounter "permission denied" errors with Docker, run:
./docker-setup.shOr manually set:
export DOCKER_HOST=unix:///var/run/docker.sock-
Build and start services
docker-compose build docker-compose up
-
Run migrations (in separate terminal)
docker-compose run web python manage.py migrate
-
Access the application
- Web interface: http://localhost:8000
- API endpoints: http://localhost:8000/notifications/
# 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- 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
GET /users/- List all usersPOST /notifications/- Create new notificationGET /- Index page
# 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]
}'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
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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
This project is open source and available under the MIT License.