A complete hotel booking management system built with Django, featuring user authentication with OTP verification, room booking, payment details, and receipt generation.
- Sign Up Page: Register with username, email, and password
- OTP Verification: 6-digit OTP sent to user's Gmail for verification
- Login Page: Secure login with email and password
- User verification required before login
- Display all available rooms with pictures
- Room types (Single, Double, Deluxe, Suite)
- Price per night for each room
- Room capacity and description
- Beautiful responsive design
- Navbar with Home, Book Now, Services, Contact Us links
- Book Now Page: Complete booking form
- Guest name and email
- Room type selection
- Check-in and check-out date picker
- Automatic calculation of:
- Number of days
- Price per night
- Total amount
- Bank details display
- QR code generation for payment
- Detailed booking receipt with:
- Unique booking ID
- Guest details
- Room information
- Check-in/Check-out dates
- Payment breakdown
- QR code for payment
- Bank account details
- Print functionality
- Services Page: Display all hotel amenities and services
- Contact Us Page: Contact form and hotel information
- Backend: Django 6.0
- Database: SQLite (can be changed to PostgreSQL/MySQL)
- Frontend: HTML5, CSS3, JavaScript
- Authentication: Django built-in auth with custom user model
- Email: SMTP (Gmail)
- QR Code: qrcode library
- Image Handling: Pillow
Hotel_Booking/
├── booking/ # Main Django app
│ ├── migrations/
│ ├── templates/
│ │ └── booking/ # HTML templates
│ │ ├── base.html # Base template with navbar
│ │ ├── signup.html # Registration page
│ │ ├── verify_otp.html # OTP verification
│ │ ├── login.html # Login page
│ │ ├── home.html # Homepage with rooms
│ │ ├── book_now.html # Booking form
│ │ ├── receipt.html # Booking receipt
│ │ ├── contact.html # Contact page
│ │ └── services.html # Services page
│ ├── models.py # Database models
│ ├── views.py # View functions
│ ├── urls.py # URL routing
│ └── admin.py # Admin configuration
├── hotel_project/ # Project settings
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── static/ # Static files
│ ├── css/
│ │ └── style.css # Main stylesheet
│ └── images/
├── media/ # User uploaded files
│ ├── rooms/ # Room images
│ └── qrcodes/ # Generated QR codes
├── manage.py
├── .env.example # Environment variables template
├── .gitignore
└── README.md
- Python 3.8 or higher
- pip
- Virtual environment (recommended)
# Navigate to project directory
cd D:\Django\Hotel_Booking
# Virtual environment is already created (.venv)
# Activate it if needed:
.venv\Scripts\activate
# Install dependencies (already done)
# pip install django pillow qrcode python-dotenvTo enable OTP functionality, you need to configure Gmail SMTP:
- Go to your Google Account settings
- Enable 2-Step Verification
- Generate an App Password: https://myaccount.google.com/apppasswords
- Open
hotel_project/settings.pyand update:
EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-app-password'Or create a .env file (copy from .env.example):
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
# Migrations are already created and applied
# If you need to reset:
python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserFollow the prompts to create an admin account.
# Run the development server
python manage.py runserverVisit: http://127.0.0.1:8000/admin/
Login with superuser credentials and add rooms:
- Navigate to "Rooms"
- Click "Add Room"
- Fill in details:
- Name (e.g., "Ocean View Suite")
- Room Type (Single/Double/Deluxe/Suite)
- Description
- Price per Night
- Capacity
- Upload Image (optional)
- Check "Is Available"
python manage.py runserverAccess the application at: http://127.0.0.1:8000/
-
Sign Up
- Go to signup page
- Enter username, email, and password
- Check your email for OTP
- Enter OTP to verify account
-
Login
- Use your email and password
- Must be verified to login
-
Browse Rooms
- View available rooms on home page
- See room types, prices, and amenities
-
Book a Room
- Click "Book Now" in navbar
- Fill in guest details
- Select room type
- Choose check-in and check-out dates
- Review calculated amount
- Submit booking
-
Payment & Receipt
- View booking receipt
- Scan QR code or use bank details for payment
- Print receipt for records
-
Access Admin Panel
- Visit: http://127.0.0.1:8000/admin/
- Login with superuser credentials
-
Manage Rooms
- Add/Edit/Delete rooms
- Upload room images
- Set prices and availability
-
Manage Bookings
- View all bookings
- Update booking status
- Filter by date, status
-
View Contact Messages
- Check customer inquiries
- Respond to messages
- Extended Django User model
- Email-based authentication
- OTP verification fields
- Email unique constraint
- Room details (name, type, description)
- Pricing and capacity
- Image upload
- Availability status
- Guest information
- Room selection
- Check-in/Check-out dates
- Auto-calculated amount
- Unique booking ID
- Status tracking
- Contact form submissions
- Customer inquiries
- CSRF protection on all forms
- Password hashing
- Login required decorators for booking
- OTP expiration (10 minutes)
- Email verification required
Edit in booking/templates/booking/book_now.html and receipt.html:
<p><strong>Bank Name:</strong> Your Bank Name</p>
<p><strong>Account Number:</strong> Your Account</p>
<p><strong>IFSC Code:</strong> Your IFSC</p>
<p><strong>UPI ID:</strong> your-upi@provider</p>Modify static/css/style.css to customize:
- Colors
- Fonts
- Layout
- Responsive breakpoints
Edit email content in booking/views.py:
send_mail(
'Your Custom Subject',
'Your custom message',
settings.EMAIL_HOST_USER,
[email],
fail_silently=False,
)Before deploying to production:
- Set
DEBUG = Falsein settings.py - Configure
ALLOWED_HOSTS - Use environment variables for sensitive data
- Setup PostgreSQL/MySQL database
- Configure static files serving
- Setup media files serving
- Enable HTTPS
- Configure proper email service
- Set strong SECRET_KEY
- Setup backup system
- Check Gmail app password
- Verify EMAIL_HOST_USER and EMAIL_HOST_PASSWORD
- Check if 2-Step Verification is enabled
- Try with a different email service
python manage.py collectstatic# Delete db.sqlite3 and migrations
# Then recreate:
python manage.py makemigrations
python manage.py migratepip install django pillow qrcode python-dotenv- Payment gateway integration
- Email notifications for bookings
- Room availability calendar
- Reviews and ratings
- Advanced search and filters
- Multiple images per room
- Booking cancellation
- User profile management
- Booking history
- PDF receipt generation
For issues and questions:
- Email: info@luxuryhotel.com
- Phone: +1 234 567 8900
This project is for educational purposes.
Developed as a full-stack Django hotel booking system with complete authentication, booking management, and payment integration.
Note: Remember to configure your Gmail settings for OTP functionality before testing the signup feature!