Skip to content

This project deals with developing an e-commerce website for Online Book Sale. It provides the user with a catalog of different books available for purchase in the store. In order to facilitate online purchase a shopping cart is provided to the user. The users are recommended on the basis of previous users rating.

Notifications You must be signed in to change notification settings

kapeed54/Online-Book-Store-With-Recommendation-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

55 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Online Book Store with Recommendation System

⚠ THE AUTHOR IS NO LONGER UPDATING THIS REPOSITORY ⚠

πŸ“– About This Project

This project is an e-commerce website for buying books online, featuring a Recommendation System that suggests books based on user ratings.

πŸ”Ή Features

  • πŸ“š Book Catalog – Browse and search books by category.
  • πŸ›’ Shopping Cart – Add books and proceed to checkout.
  • ⭐ Recommendation System – Get book recommendations using Collaborative Filtering (Matrix Factorization).
  • πŸ”’ User Authentication – Sign up, log in, and manage your profile.
  • πŸ›  Built With – Python, Django, MySQL, HTML, CSS, Bootstrap, JavaScript.

πŸ”Ή Running the Project

python manage.py runserver

Then open http://127.0.0.1:8000/ in your browser.


πŸš€ Setup Guide

If you are forking or downloading this repository, follow these steps to avoid common setup issues.


πŸ“Œ Step 1: Install MySQL

1️⃣ Install MySQL

  • Download MySQL: MySQL Community Server
  • Choose "Server Only" during installation.
  • Set a root password (remember it).

2️⃣ Verify MySQL is Running

Run:

Get-Service | Where-Object { $_.DisplayName -like "*MySQL*" }
  • If MySQL is stopped, start it:
    Start-Service MySQL
  • If using XAMPP, start MySQL manually.

πŸ“Œ Step 2: Add MySQL to System PATH

If mysql is not recognized as a command, add it to System PATH:

  1. Open Environment Variables (Win + R β†’ type sysdm.cpl β†’ "Advanced" β†’ "Environment Variables").
  2. Find "Path" under System Variables β†’ Click Edit.
  3. Click New β†’ Add:
    C:\Program Files\MySQL\MySQL Server 8.0\bin
    
  4. Click OK and Restart your PC.

Test MySQL:

mysql --version

βœ… If you see a version number, MySQL is working!


πŸ“Œ Step 3: Set Up MySQL Database

1️⃣ Open MySQL Shell

mysql -u root -p

Enter your MySQL root password.

2️⃣ Create a Database and User

Run:

CREATE DATABASE bookstore CHARACTER SET UTF8;
CREATE USER 'bookadmin'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON bookstore.* TO 'bookadmin'@'localhost';
FLUSH PRIVILEGES;
EXIT;

βœ… Your MySQL setup is now ready!


πŸ“Œ Step 4: Clone the Repository

Navigate to your project folder and clone the GitHub repository:

cd D:\GitHub
git clone https://github.com/kapeed54/Online-Book-Store-With-Recommendation-System.git
cd Online-Book-Store-With-Recommendation-System

πŸ“Œ Step 5: Set Up a Virtual Environment

Create and activate a virtual environment:

python -m venv env
.\env\Scripts\Activate

πŸ“Œ Step 6: Install Dependencies

Install all required Python packages:

pip install --upgrade pip setuptools wheel
pip install -r requirements.txt

βœ… If requirements.txt is missing, install dependencies manually:

pip install django mysqlclient numpy scipy pandas scikit-learn Pillow django-bootstrap4 gunicorn

πŸ“Œ Step 7: Configure Database in Django

Open bookstore/settings.py, update the DATABASES section:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'bookstore',  # Database name
        'USER': 'bookadmin',  # MySQL username
        'PASSWORD': 'yourpassword',  # MySQL password
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

βœ… Save the file.


πŸ“Œ Step 8: Apply Migrations

Run:

python manage.py makemigrations
python manage.py migrate

βœ… Now, your database is connected!


πŸ“Œ Step 9: Create a Superuser for Django Admin

To manage books and users via Django Admin, create a superuser:

python manage.py createsuperuser

πŸ“Œ Step 10: Load Sample Data (If Needed)

1️⃣ Add Books via Django Admin

2️⃣ Or Use the Django Shell

Run:

python manage.py shell

Then enter:

from shop.models import Product, Myrating, User

# Get an existing user
user = User.objects.first()
if not user:
    print("No users found. Please create a user first via admin panel.")
    exit()

# Add sample books if none exist
if not Product.objects.exists():
    Product.objects.create(name="The Great Gatsby", price=20, description="A classic novel", stock=10)
    Product.objects.create(name="1984", price=25, description="A dystopian novel", stock=5)
    Product.objects.create(name="To Kill a Mockingbird", price=30, description="A novel by Harper Lee", stock=8)
    print("Sample books added!")

# Add sample ratings
if not Myrating.objects.exists():
    Myrating.objects.create(user=user, product=Product.objects.first(), rating=5)
    Myrating.objects.create(user=user, product=Product.objects.last(), rating=4)
    print("Sample ratings added!")

exit()

βœ… Now your project has books and ratings!


πŸ“Œ Step 11: Run the Development Server

python manage.py runserver

Open:

βœ… Your project is now running successfully! πŸŽ‰


πŸ“Œ Troubleshooting

1️⃣ If MySQL Connection Fails

Get-Service | Where-Object { $_.DisplayName -like "*MySQL*" }
Start-Service MySQL

2️⃣ If pip install Fails

python -m pip install --upgrade pip

3️⃣ If Recommendations Don’t Work

Ensure users have rated books before trying

About

This project deals with developing an e-commerce website for Online Book Sale. It provides the user with a catalog of different books available for purchase in the store. In order to facilitate online purchase a shopping cart is provided to the user. The users are recommended on the basis of previous users rating.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages