A Django REST API for managing events, user registrations, and email notifications
-
User Management
- JWT-based authentication
- Custom user model with email authentication
- User registration and profile management
-
Event Management
- Create, read, update, and delete events
- Event registration system
- Advanced filtering and search capabilities
- Capacity management
-
Notifications
- Automated email notifications for event registrations
- Asynchronous processing using Celery
- Customizable email templates
- Docker and Docker Compose
- Python 3.11+
- PostgreSQL
- Redis (for Celery)
- Django 5.2
- Django REST Framework
- PostgreSQL
- Redis
- Celery
- JWT Authentication
- Docker
git clone <repository-url>
cd event-managementCreate a .env file in the project root:
# Django
DEBUG=1
SECRET_KEY=your-secret-key
ALLOWED_HOSTS=localhost,127.0.0.1
# Database
DATABASE_URL=postgres://postgres:postgres@db:5432/event_management
# Redis
REDIS_URL=redis://redis:6379/0
# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_HOST_USER=your.email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
EMAIL_USE_TLS=True
# JWT Settings
JWT_ACCESS_TOKEN_LIFETIME=60
JWT_REFRESH_TOKEN_LIFETIME=1440
JWT_SECRET_KEY=your-jwt-secret-keyUsing Docker Compose:
docker-compose up --builddocker-compose exec web python manage.py migrate
docker-compose exec web python manage.py createsuperuserPOST /api/token/- Obtain JWT tokensPOST /api/token/refresh/- Refresh JWT token
POST /api/users/- Register new userGET /api/users/me/- Get current user profile
GET /api/events/- List all eventsPOST /api/events/- Create new eventGET /api/events/{id}/- Get event detailsPUT/PATCH /api/events/{id}/- Update eventDELETE /api/events/{id}/- Delete eventPOST /api/events/{id}/register/- Register for event
The following filters are available for the events endpoint:
title- Search by title (contains)location- Search by locationmin_date&max_date- Filter by date rangemin_price&max_price- Filter by price rangeis_active- Filter active eventshas_available_seats- Filter events with available capacityupcoming- Filter upcoming events
Example:
GET /api/events/?upcoming=true&has_available_seats=true&location=center
For email notifications to work:
-
If using Gmail:
- Enable 2-Step Verification
- Generate App Password
- Use App Password in
.envfile
-
For development/testing:
- Set
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'in settings.py - Emails will be printed to console
- Set
docker-compose exec web python manage.py testdocker-compose exec web flake8Access the API documentation at:
- Swagger UI:
http://localhost:8000/api/docs/ - ReDoc:
http://localhost:8000/api/redoc/
For production deployment:
-
Update
.envfile with production settings:- Set
DEBUG=0 - Update
ALLOWED_HOSTS - Use secure passwords/keys
- Configure production email settings
- Set
-
Build and run:
docker-compose -f docker-compose.prod.yml up --build- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.