Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

A bus booking system allows users to search for bus routes, select seats using a visual layout, and provide passenger details to reserve tickets. It streamlines the ticket booking process with real-time seat availability, secure payments, and booking confirmations.

Notifications You must be signed in to change notification settings

Gangula-Sandaru/Online-Ticket-Booking-System-Django--BackEnd

Repository files navigation

Online Ticket Booking System (Django and React) - Installation Guide

This guide provides step-by-step instructions to set up the Online Ticket Booking System. Follow these steps to install the project and run it locally.


Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Python (version 3.10)
  • pip (Python package installer)
  • Virtualenv (optional but recommended)
  • Git
  • LocalStack
  • Node.js and npm (for React)

1. Clone the Project Repository

Start by cloning the project repository from GitHub:

git clone https://github.com/Gangula-Sandaru/Online-Ticket-Booking-System-Django-and-React.git
cd Online-Ticket-Booking-System-Django-and-React

2. Create and Activate a Virtual Environment (Optional)

It is recommended to use a virtual environment to manage dependencies:

# Create a virtual environment
python -m venv venv

# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate

3. Install Django Dependencies

Install the required Python packages using the requirements.txt file:

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the root directory and add the required configurations. Below is an example:

# Example .env file
DEBUG=True
SECRET_KEY=your_secret_key
DATABASE_URL=sqlite:///db.sqlite3  # Update with your database URL if using other DB

Replace your_secret_key with a unique secret key for the Django project.


5. Set Up the Django Project

Run the following commands to set up the database and prepare the project:

# Apply migrations
python manage.py migrate

# Create a superuser
python manage.py createsuperuser

# Collect static files
python manage.py collectstatic

6. Run the Django Development Server

Start the server to test the backend:

python manage.py runserver

The backend will be available at http://127.0.0.1:8000.


Project Structure

OnlineBooking/                      # Main project directory
├── booking/                        # App for handling booking functionality
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── migrations/                # Contains migration files
│   │   ├── __init__.py
│   ├── models.py                  # App models
│   ├── tests.py                   # Unit tests for the app
│   ├── views.py                   # View logic
│   └── urls.py                    # URL routing for the app
├── venv/                           # Virtual environment directory (excluded in `.gitignore`)
├── .env                            # Environment variables
├── .gitignore                      # Ignored files and folders for Git
├── db.sqlite3                      # SQLite database
├── manage.py                       # Django's CLI utility
├── README.md                       # Project documentation
└── requirements.txt                # Python dependencies

.env File content


# This is the Database information

DATABASE_NAME="BookingDB"
DATABASE_USER="your database username"
DATABASE_PASSWORD="your database password"
DATABASE_HOST="database engine ip address"
DATABASE_PORT="3306"

# Email information
EMAIL_HOST_USER="[email protected]"

# This is the Test Database Information

TEST_DATABASE_NAME="TestBookingDB"



Do Not Impliment the React Part At this time. we use default Django Template Engine.


7. Setting Up the Frontend (React)

Navigate to the frontend folder and install dependencies:

cd frontend
npm install

Start the React development server:

npm start

The frontend will be available at http://localhost:3000.


8. Testing the Application

Open your browser and navigate to the following URLs:

You should see the application up and running!


Notes

  • Make sure to update the .env file for production if you are deploying the project.
  • Use tools like Gunicorn and nginx for production deployment.
  • For advanced configurations, refer to the official Django and React documentation.

Author: Gangula Sandaru

Happy coding! 🎉

About

A bus booking system allows users to search for bus routes, select seats using a visual layout, and provide passenger details to reserve tickets. It streamlines the ticket booking process with real-time seat availability, secure payments, and booking confirmations.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •