A Django project that simulates YouTube video and comment management with scheduled content generation.
- Django 4.2 + Django REST Framework
- PostgreSQL
- Celery + Redis (scheduled tasks)
- Docker Compose
# Start all services (migrations run automatically)
docker compose up --build
# Create superuser (optional)
docker compose exec web uv run python manage.py createsuperuser
# Generate initial data (optional)
docker compose exec web uv run python manage.py shell -c "
from videos.tasks import generate_video, generate_comments
for _ in range(5): generate_video()
generate_comments(20)
"Note: Migrations run automatically on startup via entrypoint.sh. Celery services wait for the web service to be healthy before starting.
| Endpoint | Method | Description |
|---|---|---|
/api/videos/ |
GET | List videos (paginated) |
/api/videos/ |
POST | Create a new video |
/api/videos/{id}/ |
GET | Video detail |
/api/videos/{id}/comments/ |
GET | Comments for a video (paginated) |
/api/videos/{id}/comments/ |
POST | Add comment to video |
/api/stats/ |
GET | Engagement statistics |
/admin/ |
- | Django admin panel |
Available tasks in videos/tasks.py:
generate_video()- Create a simulated videogenerate_comments(count)- Generate random commentssimulate_activity()- Simulate YouTube-like activity
- Go to
/admin/ - Navigate to "Periodic Tasks"
- Create a task pointing to
videos.tasks.simulate_activity - Set interval (e.g., every 30 seconds)
- Video IDs are randomly generated (11 chars like YouTube)
- Comment generation uses simple template-based logic
- No authentication required for API endpoints
- Add user authentication
- Implement video view counts
- Add comment likes/replies
- Rate limiting on endpoints
- Integrate 3rd party AI services for comments generation
- Optimization
- Add SCA
- Add automated tests