A comprehensive web-based Real Estate Database Management System built with Django and MySQL. This application facilitates property listings, client management, agent operations, appointment scheduling, and transaction tracking for the real estate industry.
- Group Members: Vaibhav Sankaran, Gangatharan Idayachandiran
- Course: CS 5200 - Database Management Systems
- Institution: Northeastern University
- Semester: Fall 2025
This system serves as a central platform for managing all aspects of real estate operations, from property listing to final sale or rental. It demonstrates the practical application of database design principles, normalization techniques, and full-stack web development.
- Multi-user role management (Admin, Agent, Client)
- Complete CRUD operations for properties, appointments, transactions, and reviews
- Advanced property search with multiple filters
- Automated commission calculations
- Real-time appointment scheduling
- Property image management
- Review and rating system
- Comprehensive analytics dashboard
Backend:
- Framework: Django 4.2
- Language: Python 3.8+
- Database: MySQL 8.0+
- ORM: Django ORM
Frontend:
- Templates: Django Template Engine
- Styling: Bootstrap 5
- Icons: Bootstrap Icons
- Forms: django-crispy-forms with Bootstrap 5
Database Connector:
- PyMySQL (MySQL database adapter)
The system uses a normalized relational database with 10 main tables:
- Users - Base user authentication and information
- Agents - Real estate agent profiles
- Clients - Property buyer/renter profiles
- Properties - Property listings with detailed information
- Locations - Physical addresses and geographic data
- PropertyTypes - Property categorization
- PropertyImages - Multiple images per property
- Appointments - Property viewing schedules
- Transactions - Sales and rental records
- Reviews - Property and agent feedback
All tables are normalized to Third Normal Form (3NF):
- No partial dependencies
- No transitive dependencies
- Minimal data redundancy
Stored Procedures (3):
sp_create_property- Create new property listings with transaction handlingsp_schedule_appointment- Schedule appointments with conflict checkingsp_complete_transaction- Process sales/rentals with automatic commission calculation
User-Defined Functions (3):
fn_price_per_sqft()- Calculate price per square foot for propertiesfn_agent_total_commission()- Calculate total commission earned by an agentfn_avg_price_by_city()- Get average property price for a city
Triggers (3):
tr_update_agent_rating- Automatically update agent ratings when reviews are addedtr_check_property_delete- Prevent deletion of properties with active appointmentstr_cancel_appointments_on_status_change- Auto-cancel appointments when property status changes
Views (2):
vw_available_properties- Comprehensive view of available propertiesvw_agent_performance- Agent performance metrics
Before starting, ensure you have the following installed:
- Python 3.8 or higher
- MySQL 8.0 or higher
- pip (Python package manager)
- Virtual environment support
# Navigate to your desired directory
cd Desktop
# Create project folder
mkdir real_estate_project
cd real_estate_projectWindows:
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activateYou should see (venv) at the start of your command prompt.
pip install django==4.2
pip install pymysql
pip install python-dotenv
pip install pillow
pip install django-crispy-forms
pip install crispy-bootstrap5Option A - Using MySQL Workbench:
- Open MySQL Workbench
- Connect to your MySQL server
- File → Run SQL Script
- Select
real_estate_schema.sql - Click "Run"
Option B - Using Command Line:
mysql -u root -p < real_estate_schema.sql
# Enter your MySQL root password when promptedThe Django User model requires additional columns. Run this in MySQL:
USE real_estate_db;
-- Add Django-required fields
ALTER TABLE Users
ADD COLUMN last_login DATETIME NULL,
ADD COLUMN is_superuser BOOLEAN DEFAULT FALSE,
ADD COLUMN is_staff BOOLEAN DEFAULT FALSE,
ADD COLUMN date_joined DATETIME DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN username VARCHAR(150) NULL UNIQUE;
-- Set username to email for existing users
UPDATE Users SET username = email WHERE username IS NULL;Create a file named .env in the project root:
DB_NAME=real_estate_db
DB_USER=root
DB_PASSWORD=your_mysql_password_here
DB_HOST=localhost
DB_PORT=3306
SECRET_KEY=django-insecure-change-this-key
DEBUG=TrueImportant: Replace your_mysql_password_here with your actual MySQL password.
Open manage.py and add these lines at the very top:
import pymysql
pymysql.install_as_MySQLdb()python manage.py migrateThis creates Django's system tables (sessions, admin, etc.).
Step 7 is optional since we have a dummy user created for admin/superuser, client, and agent roles. Credentials are below:
Superuser/admin - [email protected], admin123 Client - [email protected], client123 Agent - [email protected], agent123
python manage.py createsuperuserFollow the prompts to create an admin account.
After creating the superuser, update the database:
USE real_estate_db;
UPDATE Users
SET is_superuser = TRUE,
is_staff = TRUE,
user_type = 'admin'
WHERE email = '[email protected]';Set the password properly:
python manage.py shellfrom properties.models import User
from django.contrib.auth.hashers import make_password
user = User.objects.get(email='[email protected]')
user.password = make_password('your_password')
user.save()
exit()Place property images in the static/images/ folder. The project expects these image files:
prop1_exterior.jpgprop2_exterior.jpgprop3_exterior.jpg- etc.
python manage.py runserverThe application will be available at: http://127.0.0.1:8000/
Every time you want to run the application:
-
Navigate to project directory:
cd path/to/real_estate_project -
Activate virtual environment:
# Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Start Django server:
python manage.py runserver
-
Access the application:
- Homepage:
http://127.0.0.1:8000/ - Admin Panel:
http://127.0.0.1:8000/admin/ - Analytics Dashboard:
http://127.0.0.1:8000/analytics/
- Homepage:
Press Ctrl+C in the terminal to stop the server.
- Access Django admin panel
- View system-wide statistics and analytics
- Access comprehensive analytics dashboard
- Manage all users, properties, and transactions
- Monitor system performance
- Generate analytics reports
- View market insights and trends
- Create and manage property listings
- Update property information and status
- Schedule and manage appointments
- Create transactions (sales/rentals)
- View performance metrics and analytics
- Track commission earnings
- Access analytics dashboard for market insights
- Browse and search properties
- Schedule property viewings
- Manage appointments
- Write reviews for properties and agents
- Track viewing history
- Update preferences and budget
Create:
- Agents can list new properties
- Input comprehensive property details
- Add multiple images
- Set pricing and availability
Read:
- Browse all available properties
- Advanced search with filters:
- Price range
- Location (city, zip code)
- Property type
- Number of bedrooms/bathrooms
- Listing type (sale/rent)
- View detailed property information
- See property images in carousel
Update:
- Agents can modify their listings
- Update prices and descriptions
- Change property status
- Add/remove images
Delete:
- Agents can remove their properties
- System prevents deletion if active appointments exist
Create:
- Clients schedule property viewings
- Select date and time
- Add special requests/notes
- System checks for scheduling conflicts
Read:
- View all scheduled appointments
- Filter by status (scheduled, completed, cancelled)
- See appointment details and notes
Update:
- Change appointment status
- Add notes after viewing
- Reschedule appointments
Delete:
- Cancel appointments
- Automatic cancellation when property status changes
Create:
- Agents complete sales/rentals
- System automatically calculates commission
- Update property status to sold/rented
- Record payment information
Read:
- View transaction history
- Filter by type (sale/rental)
- See commission details
- Track payment status
Create:
- Clients write reviews
- Rate properties (1-5 stars)
- Rate agents
- Provide detailed feedback
Read:
- View all reviews
- See average ratings
- Filter reviews by property or agent
Delete:
- Users can delete their own reviews
- Admins can moderate reviews
Clients:
- Set budget preferences
- Specify desired locations
- Indicate purchase/rental intent
- Update contact preferences
Agents:
- Update license information
- Manage agency details
- Set commission rates
- Track performance metrics
Property Search:
- Keyword search (title, city, description)
- Multi-filter search with:
- Price range (min/max)
- Location (city)
- Property type
- Number of bedrooms
- Listing type (sale/rent)
- Status (available, pending, sold, rented)
- Sort by price, date, location
- Real-time search results
System-wide Analytics (Admin/Agent access):
- Key Metrics:
- Total properties in system
- Available properties count
- Sold properties count
- Average property price
- Properties by Type:
- Distribution across property types
- Count and percentage breakdown
- Geographic Analysis:
- Top cities by property count
- City-wise distribution
- Price Distribution:
- Average prices by location
- Market pricing insights
- Property Status Overview:
- Visual breakdown of all statuses
- Available, pending, sold, rented counts
- Market Insights:
- Most popular property type
- Most active city
- Market availability percentage
real_estate_project/
├── venv/ # Virtual environment
├── real_estate_system/ # Main project settings
│ ├── __init__.py
│ ├── settings.py # Django configuration
│ ├── urls.py # Main URL routing
│ ├── wsgi.py
│ └── asgi.py
├── properties/ # Main application
│ ├── migrations/ # Database migrations
│ ├── __init__.py
│ ├── admin.py # Admin interface config
│ ├── apps.py
│ ├── backends.py # Custom authentication
│ ├── models.py # Database models (ORM)
│ ├── views.py # Business logic (26 views)
│ ├── urls.py # App URL routing
│ ├── forms.py # Form definitions
│ └── tests.py
├── templates/ # HTML templates
│ ├── base.html # Base template
│ ├── home.html # Homepage
│ ├── registration/ # Auth templates
│ │ ├── login.html
│ │ └── register.html
│ ├── dashboard/ # Dashboard templates
│ │ ├── client_dashboard.html
│ │ ├── agent_dashboard.html
│ │ └── admin_dashboard.html
│ ├── properties/ # Property templates
│ │ ├── property_list.html
│ │ ├── property_detail.html
│ │ ├── property_form.html
│ │ └── property_confirm_delete.html
│ ├── profile/ # Profile templates
│ │ ├── client_profile_form.html
│ │ └── agent_profile_form.html
│ ├── appointments/ # Appointment templates
│ │ ├── appointment_list.html
│ │ ├── appointment_form.html
│ │ ├── appointment_update.html
│ │ └── appointment_confirm_delete.html
│ ├── transactions/ # Transaction templates
│ │ ├── transaction_list.html
│ │ ├── transaction_detail.html
│ │ └── transaction_form.html
│ ├── reviews/ # Review templates
│ │ ├── review_form.html
│ │ └── review_confirm_delete.html
│ └── analytics/ # Analytics templates
│ └── analytics.html
├── static/ # Static files
│ ├── css/ # Custom stylesheets
│ ├── js/ # JavaScript files
│ └── images/ # Property images
├── media/ # User-uploaded files
│ └── property_images/
├── manage.py # Django management script
├── requirements.txt # Python dependencies
├── .env # Environment variables
└── real_estate_schema.sql # Database schema
- Password Hashing: All passwords encrypted using PBKDF2-SHA256
- CSRF Protection: Cross-site request forgery protection on all forms
- SQL Injection Prevention: Django ORM prevents SQL injection
- Role-Based Access Control: Users can only access authorized features
- Session Management: Secure session handling
- Input Validation: All user inputs validated before processing
- Login as agent
- Create a new property
- View property details
- Update property information
- Attempt to delete property
- Login as client
- Browse properties
- Schedule an appointment
- View appointments list
- Update appointment status
- Cancel an appointment
- Login as agent
- Navigate to a property
- Create a transaction
- Verify commission calculation
- Check property status update
- Login as client
- View a property
- Write a review with rating
- View review on property page
- Delete review
- Login as admin or agent
- Navigate to Analytics page
- View system-wide statistics
- Check properties by type breakdown
- Review top cities data
- Examine price distribution
- Verify all metrics display correctly
After each operation, verify in MySQL Workbench:
USE real_estate_db;
-- Check properties
SELECT * FROM Properties ORDER BY created_at DESC LIMIT 5;
-- Check appointments
SELECT * FROM Appointments ORDER BY created_at DESC LIMIT 5;
-- Check transactions
SELECT * FROM Transactions ORDER BY transaction_date DESC LIMIT 5;
-- Check reviews
SELECT * FROM Reviews ORDER BY review_date DESC LIMIT 5;The database includes sample data:
- 10 pre-loaded properties
- Multiple property images
- Sample users (agents and clients)
- Property types (Single Family, Condo, Townhouse, etc.)
- Various locations in Massachusetts
Issue: "Table doesn't exist" errors
- Solution: Run migrations -
python manage.py migrate
Issue: Images not showing
- Solution: Check if images are in
static/images/folder - Run:
python manage.py collectstatic - Verify image URLs in database
Issue: Login not working
- Solution: Reset password using Django shell (see Setup Step 7)
Issue: "Module not found" errors
- Solution: Activate virtual environment and reinstall packages
pip install -r requirements.txt
Issue: Database connection fails
- Solution: Check MySQL is running
- Verify credentials in
.envfile - Test connection:
python manage.py dbshell
Issue: Port 8000 already in use
- Solution: Use different port
python manage.py runserver 8080
Django==4.2
pymysql
python-dotenv
Pillow
django-crispy-forms
crispy-bootstrap5
- Bootstrap 5: CSS framework (CDN)
- Bootstrap Icons: Icon library (CDN)
- MySQL 8.0+: Database server
This project demonstrates:
-
Database Design:
- Entity-Relationship modeling
- Normalization (3NF)
- Referential integrity
- Constraint implementation
-
SQL Programming:
- Stored procedures
- User-defined functions
- Triggers
- Complex queries with joins
-
Full-Stack Development:
- Backend API design
- Frontend templating
- Form handling and validation
- User authentication and authorization
-
Software Engineering:
- MVC architecture (Django MVT)
- Code organization
- Error handling
- Security best practices
Potential improvements for the system:
-
Advanced Features:
- Real-time notifications
- Email integration
- SMS alerts for appointments
- Payment gateway integration
- Property comparison tool
- Mortgage calculator
-
Analytics:
- Market trend analysis with visual representations
- Price prediction models
- Interactive agent performance dashboards
- Advanced charts and graphs using Chart.js or D3.js
- Historical data comparison
- Predictive analytics for property values
- Seasonal trend analysis
-
User Experience:
- Mobile responsive design
- Progressive Web App (PWA)
- Advanced filtering options
- Saved searches
- Favorite properties
- Virtual property tours
-
Integration:
- Google Maps API for location
- Third-party property listings
- CRM integration
- Document management
- E-signature capabilities
This project is developed for educational purposes as part of the CS 5200 Database Management Systems course at Northeastern University.
- Vaibhav Sankaran
- Gangatharan Idayachandiran
For issues or questions:
- Email: [email protected]
- Course: CS 5200 - Database Management Systems
- Institution: Northeastern University
- Course Instructor and Teaching Assistants
- Northeastern University CS Department
- Django Documentation
- Bootstrap Framework
- MySQL Community
Last Updated: November 2025
Version: 1.0