This is a simple e-commerce application built with Django. It includes basic features such as item listing, item details, cart management, and checkout.
- Item Listing
- Item Details
- Add to Cart
- Reduce Item Quantity in Cart
- Remove Item from Cart
- Checkout
-
Clone the repository
git clone https://github.com/your-username/ecommerce.git cd ecommerce
-
Create a virtual environment and activate it
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages
pip install -r requirements.txt
-
Run migrations
python manage.py makemigrations python manage.py migrate
-
Create a superuser to access the admin panel
python manage.py createsuperuser
-
Start the development server
python manage.py runserver
-
Access the application
Open your browser and navigate to
http://127.0.0.1:8000/
to access the application. You can access the admin panel athttp://127.0.0.1:8000/admin/
.
ecommerce/
: Main project directory.settings.py
: Project settings.urls.py
: URL routing.wsgi.py
: WSGI configuration.
shop/
: Application directory.admin.py
: Admin configuration.models.py
: Database models.urls.py
: URL routing for the application.views.py
: View functions.templates/shop/
: HTML templates.
name
: CharField
name
: CharFielddescription
: TextFieldimage
: ImageFieldcategory
: ForeignKey to Categoryprice
: DecimalField
/
: Item list view/item/<int:pk>/
: Item detail view/cart/
: Cart detail view/checkout/
: Checkout view/add-to-cart/<int:pk>/
: Add item to cart/reduce_quantity/<int:item_id>/
: Reduce item quantity in cart/remove_item/<int:item_id>/
: Remove item from cart
item_list
: Displays a list of items with search functionality.item_detail
: Displays the details of a single item.cart_detail
: Displays the contents of the cart.checkout
: Displays the checkout page.add_to_cart
: Adds an item to the cart.reduce_quantity
: Reduces the quantity of an item in the cart.remove_item
: Removes an item from the cart.
STATIC_URL
: URL for static files.MEDIA_URL
: URL for media files.MEDIA_ROOT
: Root directory for media files.