MusicStore is a Django web application for selling music-related products such as albums, instruments, and accessories. The project includes user accounts, product catalog, shopping cart, checkout, orders, and a fake payment system.
- User registration and login.
- User profile page.
- Product catalog.
- Product detail page.
- Session-based shopping cart.
- Add products to cart.
- Remove products from cart.
- Checkout form.
- Order creation.
- Order history.
- Order detail page.
- Fake payment system.
- Different fake card payment methods.
- MySQL database.
- Dockerized MySQL setup.
- Django admin panel.
- Python
- Django
- MySQL
- Docker
- HTML
- Django Templates
- PyMySQL
- python-dotenv
MusicStore/
├── accounts/
├── cart/
├── config/
├── orders/
├── payments/
├── products/
├── templates/
├── docker-compose.yml
├── manage.py
├── requirements.txt
└── .env
The products app is responsible for the product catalog.
It contains:
- Product model.
- Product list page.
- Product detail page.
- Product admin registration.
Product types:
- Album.
- Instrument.
- Accessory.
The accounts app is responsible for user authentication.
It contains:
- Registration.
- Login.
- Logout.
- Profile page.
The project uses Django's built-in user model.
The cart app is responsible for the shopping cart.
The cart is stored in the user session. It does not use a separate database model.
Example session cart:
{
"1": 2,
"5": 1
}This means:
Product with id 1 has quantity 2.
Product with id 5 has quantity 1.
The orders app is responsible for checkout and order saving.
It contains:
- Order model.
- OrderItem model.
- Checkout form.
- Order detail page.
- Order history page.
After checkout, cart data is converted into database records.
The payments app is responsible for fake payment simulation.
It contains:
- Payment model.
- Payment form.
- Payment method selection.
- Card last 4 digits saving.
- Order status update.
Payment changes order status from:
new → paid
This is only a fake payment system. The project does not process real payments.
Stores product information.
Main fields:
- name
- price
- product_type
- description
- artist
- brand
- created_at
Stores user order information.
Main fields:
- user
- full_name
- phone
- address
- total_price
- status
- created_at
Stores products inside an order.
Main fields:
- order
- product
- quantity
- price
Stores fake payment information.
Main fields:
- order
- payment_method
- card_last4
- status
- created_at
git clone <repository-url>
cd MusicStorepython -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
SECRET_KEY=django-insecure-local-music-store-key
DEBUG=True
MYSQL_DATABASE=music_store
MYSQL_USER=music_user
MYSQL_PASSWORD=music_password
MYSQL_ROOT_PASSWORD=root_password
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306docker compose up -dpython manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverOpen the project in browser:
http://127.0.0.1:8000/products/
/products/ Product list
/products/<id>/ Product detail
/accounts/register/ Register
/accounts/login/ Login
/accounts/logout/ Logout
/accounts/profile/ Profile
/cart/ Cart detail
/cart/add/<id>/ Add product to cart
/cart/remove/<id>/ Remove product from cart
/orders/ Order history
/orders/checkout/ Checkout
/orders/<id>/ Order detail
/payments/pay/<id>/ Fake payment page
/admin/ Django admin panel
- User opens the product catalog.
- User opens product detail page.
- User adds product to cart.
- Cart stores product IDs and quantities in session.
- User opens cart page.
- User clicks checkout.
- User enters delivery information.
- Django creates an order and order items in MySQL.
- Cart is cleared.
- User can pay for the order using fake card payment.
- Order status changes from
newtopaid.
This project is created for learning purposes.
The payment system is fake. It does not process real bank cards. It only stores the last 4 digits of the entered card number.
The project uses environment variables for database settings and secret key.
Possible improvements:
- Product images.
- Product search.
- Product filtering by type.
- Quantity update in cart.
- Better design with CSS.
- Email confirmation after order.
- Real payment gateway integration.
- API version with Django REST Framework.
- Deployment to server.
Created as a Django learning project.