A production-ready, AI-powered movie recommendation system built with Django and advanced machine learning. Scalable from thousands to millions of movies.
- Overview
- Screenshots
- Features
- Quick Start
- Project Structure
- Usage
- Model Training
- API Reference
- Configuration
- Documentation
- Contributing
- License
The Movie Recommendation System provides intelligent movie suggestions using content-based filtering with TF-IDF and SVD dimensionality reduction. It features a modern web interface, RESTful API, and supports datasets from 2K to 1M+ movies.
- β Production Ready - Security hardened, optimized, well-documented
- β Scalable Architecture - Handles millions of movies efficiently
- β Modern Tech Stack - Django 5.0, Python 3.10+, advanced ML
- β Easy to Use - Simple installation, clear documentation
- β Flexible - Train your own models or use demo models
- Backend: Django 6.0, Python 3.10+
- ML/Data: scikit-learn, pandas, numpy, scipy
- Storage: Parquet (efficient data format)
- Deployment: Render, Heroku, Docker compatible
- π Smart Search - Real-time autocomplete with fuzzy matching
- π¬ AI Recommendations - Content-based filtering with 15+ suggestions
- β Rich Metadata - Ratings, votes, genres, production companies
- π External Links - Google Search and IMDb integration
- π± Responsive Design - Works seamlessly on all devices
- β‘ Fast Performance - Sub-50ms recommendation generation
- π€ Advanced ML - TF-IDF + SVD dimensionality reduction
- π Scalable - Handles 2K to 1M+ movies
- πΎ Efficient Storage - Parquet format with compression
- π§ Configurable - Easy model switching via
MODEL_DIR - π‘ REST API - JSON endpoints for integration
- π Secure - Production-ready security settings
- π Logging - Comprehensive error tracking
- π Deployment Ready - Render, Heroku, Docker configs included
- Python 3.10 or higher
- pip package manager
- 8GB RAM (recommended for training)
- Git
# 1. Clone the repository
git clone https://github.com/yourusername/movie-recommendation-system.git
cd movie-recommendation-system
# 2. Create virtual environment
python -m venv venv
# 3. Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# 4. Install dependencies
pip install -r requirements.txt
# 5. Run database migrations
python manage.py migrate
# 6. Start the development server
python manage.py runserverOpen your browser and navigate to:
http://localhost:8000
That's it! The demo model (2K movies) is included and works out of the box. π
movie-recommendation-system/
β
βββ π Documentation
β βββ README.md # This file - overview and quick start
β βββ PROJECT_GUIDE.md # Complete technical guide
β βββ CHANGELOG.md # Version history and changes
β
βββ βοΈ Django Application
β βββ movie_recommendation/ # Django project settings
β β βββ settings.py # Configuration
β β βββ urls.py # URL routing
β β βββ wsgi.py # WSGI entry point
β β
β βββ recommender/ # Main application
β β βββ views.py # Recommendation logic
β β βββ urls.py # App URLs
β β βββ templates/ # HTML templates
β β βββ recommender/
β β βββ index.html # Search page
β β βββ result.html # Results page
β β βββ error.html # Error page
β β
β βββ manage.py # Django management script
β βββ requirements.txt # Python dependencies
β
βββ π Model Training
β βββ training/
β βββ train.py # Training pipeline
β βββ infer.py # Inference examples
β βββ guide.md # Training documentation
β
βββ π― Models (Created after training)
β βββ models/
β βββ movie_metadata.parquet # Movie information
β βββ similarity_matrix.npz # Similarity scores
β βββ title_to_idx.json # Title mappings
β βββ tfidf_vectorizer.pkl # TF-IDF model
β βββ svd_model.pkl # SVD reduction model
β
βββ π¦ Static Files
β βββ static/
β βββ logo.png # Application logo
β βββ demo_model.parquet # Demo similarity model (2K)
β βββ top_2k_movie_data.parquet # Demo movie data (2K)
β
βββ π Deployment
βββ Procfile # Heroku configuration
βββ render.yaml # Render configuration
βββ .gitignore # Git ignore rules
-
Search for a Movie
- Go to
http://localhost:8000 - Start typing a movie name in the search box
- Select from autocomplete suggestions or type the full name
- Go to
-
View Recommendations
- Click "Get Recommendations"
- Browse 15 similar movie suggestions
- Each card shows: rating, release date, genres, production company
-
Explore Movies
- Click "Google" to search for the movie
- Click "IMDb" to view on IMDb (if available)
GET /api/search/?q=matrix
Response:
{
"movies": ["The Matrix", "The Matrix Reloaded", "The Matrix Revolutions"],
"count": 3
}GET /api/health/
Response:
{
"status": "healthy",
"movies_loaded": 100000,
"model_dir": "./models",
"model_loaded": true
}The project includes a pre-trained demo model with 2,000 popular movies. No training needed!
# Demo model is in static/ directory
export MODEL_DIR=./static
python manage.py runserverWant to train on more movies or your own dataset? See the Training Guide for:
- π Complete training documentation
- π― Configuration options (10K to 1M+ movies)
- βοΈ Performance tuning guidelines
- π Dataset requirements
- π§ Advanced features
Quick Training Example:
from training.train import MovieRecommenderTrainer
# Initialize trainer
trainer = MovieRecommenderTrainer(
output_dir='./models',
use_dimensionality_reduction=True,
n_components=500
)
# Train on your dataset
df, sim_matrix = trainer.train(
'path/to/your/dataset.csv',
quality_threshold='medium', # low/medium/high
max_movies=100000 # Limit dataset size
)For detailed training instructions, see:
- π Training Guide - Complete training documentation
- π PROJECT_GUIDE.md - Training setup and configurations
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Home page with search interface |
/ |
POST | Submit movie search and get recommendations |
/api/search/ |
GET | Search movies (autocomplete) |
/api/health/ |
GET | Health check endpoint |
Request:
GET /api/search/?q=inceptionResponse:
{
"movies": ["Inception", "Inception: The Cobol Job"],
"count": 2
}Request:
GET /api/health/Response:
{
"status": "healthy",
"movies_loaded": 100000,
"model_dir": "./models",
"model_loaded": true
}For complete API documentation, see PROJECT_GUIDE.md - API Reference
Create a .env file (optional for development):
# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Model Configuration
MODEL_DIR=./models
# Database (optional - defaults to SQLite)
# DATABASE_URL=postgresql://user:password@localhost/dbname
# Deployment
# RENDER_EXTERNAL_HOSTNAME=your-app.onrender.comTo switch between models, set the MODEL_DIR environment variable:
# Use demo model (2K movies)
export MODEL_DIR=./static
# Use your trained model (custom)
export MODEL_DIR=./models
# Use absolute path
export MODEL_DIR=/path/to/your/modelsFor detailed configuration options, see PROJECT_GUIDE.md - Configuration
- README.md (this file) - Overview, quick start, basic usage
- PROJECT_GUIDE.md - Complete technical guide
- Installation
- Model training
- Configuration
- Development
- Deployment
- API reference
- Troubleshooting
- CHANGELOG.md - Version history and changes
- training/guide.md - Complete model training guide
- Dataset requirements
- Training configurations
- Performance tuning
- Advanced features
| Topic | Documentation |
|---|---|
| Installation | Quick Start or PROJECT_GUIDE.md |
| Model Training | training/guide.md |
| Deployment | PROJECT_GUIDE.md - Deployment |
| API Reference | API Reference or PROJECT_GUIDE.md |
| Troubleshooting | PROJECT_GUIDE.md - Troubleshooting |
| Configuration | Configuration or PROJECT_GUIDE.md |
- Push your code to GitHub
- Connect repository to Render
- Render auto-detects
render.yaml - Set environment variables
- Deploy!
- Heroku: Uses
Procfile - Docker: Create Dockerfile from PROJECT_GUIDE
- AWS: Elastic Beanstalk compatible
- Digital Ocean: App Platform ready
For detailed deployment instructions, see PROJECT_GUIDE.md - Deployment
Contributions are welcome! Here's how:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 style guide
- Add tests for new features
- Update documentation
- Keep commits focused and descriptive
This project is licensed under the MIT License - see the LICENSE file for details.
Need help? Here are your options:
- π Documentation: Check PROJECT_GUIDE.md for detailed guides
- π Training Help: See training/guide.md for model training
- π Issues: Open an issue on GitHub
- π¬ Discussions: GitHub Discussions
- User authentication system
- Personal watchlists
- Movie rating system
- Advanced filtering (multiple genres, year ranges)
- Recommendation history
- Collaborative filtering
- Social features (sharing, comments)
- Movie reviews
- Advanced analytics dashboard
- Mobile applications (iOS/Android)
- Real-time recommendations
- Streaming service integration
- Enhanced ML models (hybrid recommendations)
| Metric | Value |
|---|---|
| Recommendation Time | < 50ms |
| Search Response | < 100ms |
| Page Load | < 200ms |
| Memory Usage | ~200MB (100K movies) |
| Concurrent Users | 1000+ |
| Model Size | 180MB (100K movies) |
- Movie data from TMDB and IMDb
- Built with Django, scikit-learn, pandas
- UI inspired by modern design principles
- Community contributions and feedback
Made with β€οΈ for movie lovers and developers
β Star this repo β’ π Report Bug β’ π‘ Request Feature





