β THE AUTHOR IS NO LONGER UPDATING THIS REPOSITORY β
This project is an e-commerce website for buying books online, featuring a Recommendation System that suggests books based on user ratings.
- π 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.
python manage.py runserverThen open http://127.0.0.1:8000/ in your browser.
If you are forking or downloading this repository, follow these steps to avoid common setup issues.
- Download MySQL: MySQL Community Server
- Choose "Server Only" during installation.
- Set a root password (remember it).
Run:
Get-Service | Where-Object { $_.DisplayName -like "*MySQL*" }- If MySQL is stopped, start it:
Start-Service MySQL
- If using XAMPP, start MySQL manually.
If mysql is not recognized as a command, add it to System PATH:
- Open Environment Variables (Win + Rβ typesysdm.cplβ "Advanced" β "Environment Variables").
- Find "Path" under System Variables β Click Edit.
- Click New β Add:
C:\Program Files\MySQL\MySQL Server 8.0\bin
- Click OK and Restart your PC.
Test MySQL:
mysql --versionβ If you see a version number, MySQL is working!
mysql -u root -pEnter your MySQL root password.
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!
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-SystemCreate and activate a virtual environment:
python -m venv env
.\env\Scripts\ActivateInstall 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 gunicornOpen 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.
Run:
python manage.py makemigrations
python manage.py migrateβ Now, your database is connected!
To manage books and users via Django Admin, create a superuser:
python manage.py createsuperuser- Enter Username, Email, and Password.
- Log in at http://127.0.0.1:8000/admin/.
- Go to: http://127.0.0.1:8000/admin/
- Log in and manually add some books.
Run:
python manage.py shellThen 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!
python manage.py runserverOpen:
- Homepage: http://127.0.0.1:8000/
- Admin Panel: http://127.0.0.1:8000/admin/
- Get Recommendations: http://127.0.0.1:8000/recommend/
β Your project is now running successfully! π
Get-Service | Where-Object { $_.DisplayName -like "*MySQL*" }
Start-Service MySQLpython -m pip install --upgrade pipEnsure users have rated books before trying recommendations.
π Now the setup steps are logically ordered and easier to follow!
This README format is perfect for GitHub and blends the original project introduction with the updated setup instructions.
Let me know if you want any final tweaks before committing this! π―