This Django-based web application provides a platform for analyzing e-commerce product data and generating comprehensive reports. It includes features for data aggregation, user authentication using JWT tokens, and dynamic CSV report generation.
-
Data Analysis:
- Calculate total revenue, top-selling products, and quantities sold by category.
- Utilizes Django ORM for efficient data retrieval and aggregation.
-
Reporting:
- Generate summary reports in CSV format with categories, total revenue, top products, and quantities sold.
- Download reports directly from the application.
-
User Authentication:
- Secure login and sign-up system using JWT tokens.
- Endpoints for user registration (
/signup/
) and login (/login/
).
- Python 3.12
- Django 5.0.6
- PostgreSQL (or another supported database) in this sqlite3 is used
- Git (optional, for cloning the repository)
-
Clone the Repository
git clone https://github.com/ppinklesh/Stantech.git cd ecommerce
-
Setup Python Virtual Environment
Create and activate a virtual environment:
python -m venv venv # Windows venv\Scripts\activate # Linux/macOS source venv/bin/activate
-
Install Dependencies
Install required Python packages:
pip install -r requirements.txt
-
Database Configuration
Configure database settings in
ecommerce/settings.py
:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'your_database_name', 'USER': 'your_database_user', 'PASSWORD': 'your_database_password', 'HOST': 'localhost', 'PORT': '5432', } }
-
Run Migrations
Apply initial database migrations:
python manage.py migrate
-
Start the Development Server
Launch the Django development server:
python manage.py runserver
Access the application at
http://localhost:8000/
.
-
Django provides a built-in admin interface for managing database records:
python manage.py createsuperuser
-
Access the admin interface at
http://localhost:8000/admin/
to manage users, products, and other data.
-
To upload .csv file for product data. follow below command:
-
Make sure the format of csv should be correct. fields should be 'product_name', 'category', 'price', 'quantity_sold', 'rating', 'review_count'
python manage.py upload_data products.csv
- Navigate to
/summary_report_csv/
to download the CSV summary report. - Navigate to
/summary_report/
to display summary report. - Use
/signup/
and/login/
endpoints for user registration and authentication.