Unicart is a simple e-commerce platform built using Django. It provides functionalities for managing products, carts, orders, and discount codes. The project is designed to demonstrate the use of Django's ORM, REST framework, and other features for building a scalable web application.
- User authentication and cart management.
- Add products to the cart and checkout with optional discount codes.
- Admin panel for managing products, orders, and discount codes.
- REST API endpoints for cart and order operations.
- Python 3.8+
- Django 5.1+
- Django REST Framework
- Poetry (for dependency management)
-
Clone the repository:
git clone [email protected]:prince-dsd/unicart.git cd unicart
-
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 - -
Install dependencies using Poetry:
poetry install
-
Set up the
.envfile: Create a.envfile in the root directory of the project and add the following keys:SECRET_KEY='your-django-secret-key' DATABASE_URL='your-database-url'
Replace
your-django-secret-keywith a secure key for your Django application, andyour-database-urlwith the connection string for your database. -
Set up the database:
python manage.py makemigrations python manage.py migrate
-
Create a superuser for the admin panel:
python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
To run the tests for the application, use the following command:
python manage.py testThis will execute all the test cases defined in the store/tests/ directory and provide a summary of the results.
-
Access the application in your browser at
http://127.0.0.1:8000/. -
Use the admin panel at
http://127.0.0.1:8000/admin/to manage products, orders, and discount codes. -
Use the API endpoints to interact with the cart and order functionalities:
- Add items to the cart:
POST /cart/add_item/ - Checkout:
POST /cart/checkout/
- Add items to the cart:
store/: Contains the main application logic, including models, views, serializers, and URLs.unicart/: Contains project-level settings and configurations.manage.py: Django's command-line utility for administrative tasks.
This project is licensed under the MIT License.