A complete Django-based online bookstore management system with MySQL database.
- 📚 Browse books by category
- 🔍 View detailed book information
- 🛒 Shopping cart functionality
- 📦 Order placement and management
- 👨💼 Admin panel for inventory management
- 💳 Customer checkout with order confirmation
- 📱 Responsive design
- Backend: Python 3.x, Django 6.0
- Database: MySQL
- Frontend: HTML5, CSS3, Django Templates
- ORM: Django ORM
Before running this project, ensure you have:
- Python 3.x installed
- MySQL Server installed and running
- pip (Python package manager)
- Navigate to project directory:
cd /home/n/Desktop/new_project/bookstore_project-
Update MySQL password in settings.py:
- Open
bookstore_project/settings.py - Find the
DATABASESsection - Update the
PASSWORDfield with your MySQL root password
- Open
-
Run the setup script:
./setup.shThe script will:
- Verify MySQL installation
- Create the database
- Run migrations
- Prompt you to create a superuser
- Start the development server
- Create virtual environment (if not exists):
cd /home/n/Desktop/new_project
python3 -m venv venv
source venv/bin/activate- Install dependencies:
pip install django mysqlclient- Create MySQL database:
mysql -u root -pCREATE DATABASE bookstore_db;
exit;-
Update database password:
- Edit
bookstore_project/settings.py - Update MySQL password in
DATABASESconfiguration
- Edit
-
Run migrations:
cd bookstore_project
python manage.py makemigrations
python manage.py migrate- Create superuser:
python manage.py createsuperuser- Start development server:
python manage.py runserver- Main Website: http://127.0.0.1:8000/
- Admin Panel: http://127.0.0.1:8000/admin/
bookstore_project/
├── manage.py
├── setup.sh # Automated setup script
├── bookstore_project/ # Main project settings
│ ├── settings.py # Database & app configuration
│ ├── urls.py # Main URL routing
│ └── wsgi.py
├── books/ # Books app
│ ├── models.py # Book & Category models
│ ├── views.py # Book listing & details
│ ├── urls.py
│ └── admin.py
├── cart/ # Shopping cart app
│ ├── models.py # CartItem model
│ ├── views.py # Cart operations
│ ├── urls.py
│ └── admin.py
├── orders/ # Orders app
│ ├── models.py # Order & OrderItem models
│ ├── views.py # Checkout & confirmation
│ ├── forms.py # Order form
│ ├── urls.py
│ └── admin.py
├── templates/ # HTML templates
│ ├── base.html
│ ├── home.html
│ ├── book_detail.html
│ ├── cart.html
│ ├── place_order.html
│ └── order_confirmation.html
└── static/ # Static files
└── css/
└── style.css
- Category: Book categories (Fiction, Non-Fiction, etc.)
- Book: Book details (title, author, price, stock, etc.)
- CartItem: Shopping cart items with quantity
- Order: Customer orders with delivery info
- OrderItem: Individual items in an order
-
Login to Admin Panel:
- Go to http://127.0.0.1:8000/admin/
- Use superuser credentials
-
Add Categories:
- Click "Categories" → "Add Category"
- Enter category name (e.g., Fiction, Science, History)
-
Add Books:
- Click "Books" → "Add Book"
- Fill in book details (title, author, category, price, stock, description)
- Save
-
Manage Orders:
- View all orders in "Orders" section
- Update order status (Pending → Confirmed → Delivered)
-
Browse Books:
- Visit home page
- Filter by category
- View book details
-
Add to Cart:
- Click "Add to Cart" on any book
- View cart to see items
-
Checkout:
- Click "Proceed to Checkout"
- Fill in delivery information
- Place order
-
Order Confirmation:
- View order details
- Note order ID for reference
- Modern UI: Gradient backgrounds, card-based layouts
- Responsive Design: Works on desktop and mobile
- Real-time Cart: Session-based cart for guest users
- Admin Dashboard: Full CRUD operations for books and orders
- Order Tracking: View order status and history
- CSRF protection on all forms
- SQL injection prevention via Django ORM
- Password hashing for admin users
- Session-based authentication
After setup, add some sample books via admin panel:
Example Books:
- Title: "The Great Gatsby", Author: "F. Scott Fitzgerald", Category: "Fiction", Price: 299
- Title: "Sapiens", Author: "Yuval Noah Harari", Category: "Non-Fiction", Price: 499
- Title: "Python Crash Course", Author: "Eric Matthes", Category: "Programming", Price: 599
- Verify MySQL is running:
sudo systemctl status mysql - Check password in
settings.py - Ensure database exists:
SHOW DATABASES;
- Delete migration files (except
__init__.py) - Run:
python manage.py makemigrationsthenpython manage.py migrate
- Run:
python manage.py collectstatic - Check
STATIC_URLin settings.py
- Kill existing process:
sudo lsof -t -i tcp:8000 | xargs kill -9 - Or use different port:
python manage.py runserver 8080
- Developed a full-stack Online Bookstore using Django MVT architecture with Python and MySQL
- Implemented CRUD operations for books, cart, and order management using Django ORM
- Created responsive UI using HTML5, CSS3, and Django Template Language
- Integrated Django Admin panel for efficient backend management
- Built shopping cart functionality with session-based storage
- Designed relational database schema with proper foreign key relationships
This is a college project for educational purposes.
Created as a Django learning project demonstrating full-stack web development.
✅ Your Bookstore is LIVE!
🌐 Access the Application:
- Main Website: http://127.0.0.1:8000/
- Admin Panel: http://127.0.0.1:8000/admin/
- Username:
admin - Password:
admin123
- Username:
📝 Next Steps:
- Login to admin panel
- Add categories (Fiction, Science, etc.)
- Add sample books with prices and stock
- Test the application
To Run Again Later:
cd /home/n/Desktop/new_project/bookstore_project
source ../venv/bin/activate
python manage.py runserver