Welcome to the ShopnowEcommerce project. This document provides comprehensive instructions for setting up, running, and contributing to the project in a local development environment.
- Project Overview
- Prerequisites
- Environment Setup
- Running the Application
- Environment Variables
- Production Build
- Troubleshooting
- Project Structure
- Contributing
- Contact
ShopnowEcommerce is a modern e-commerce platform featuring a Django REST backend and a Vue 3 frontend powered by Vite. The project is structured for scalability, maintainability, and ease of collaboration.
- Python 3.10+
- Node.js 18+ and npm
- pip (Python package manager)
- (Recommended) virtualenv for Python
- PowerShell (for Windows users)
- Open PowerShell and navigate to the backend directory:
cd backend
- Create and activate a virtual environment:
python -m venv venv .\venv\Scripts\Activate.ps1 - Install Python dependencies:
pip install -r ..\requirements.txt - Apply database migrations:
python manage.py migrate
- (Optional) Create a superuser for admin access:
python manage.py createsuperuser
- In a new PowerShell window, navigate to the frontend directory:
cd frontend
- Install Node.js dependencies:
npm install
cd backend
.\venv\Scripts\Activate.ps1
python manage.py runserverThe backend will be available at http://localhost:8000
cd frontend
npm run devThe frontend will be available at http://localhost:5173
- Django:
- Configure sensitive settings (e.g.,
SECRET_KEY, database credentials) inbackend/.env(use python-dotenv or similar if needed).
- Configure sensitive settings (e.g.,
- Vue:
- Place frontend environment variables in
frontend/.env(see Vite env docs).
- Place frontend environment variables in
- Build the frontend for production:
The output will be in
cd frontend npm run build
frontend/dist/. - Configure Django to serve static files from the frontend build:
- Update
STATICFILES_DIRSorSTATIC_ROOTinbackend/settings.py. - Collect static files:
cd backend python manage.py collectstatic
- Update
- CORS Errors: Ensure
django-cors-headersis installed andCORS_ALLOWED_ORIGINSincludes your frontend URL. - API Proxy: In
frontend/vite.config.js, proxy/apitohttp://localhost:8000for local development. - Dependency Issues:
- For Python: Ensure the virtual environment is activated and dependencies are installed.
- For Node: Delete
node_modulesand runnpm installif issues persist.
- Port Conflicts: Make sure ports 8000 (backend) and 5173 (frontend) are available.
ShopnowEcommerce/
├── backend/ # Django backend
│ ├── api/ # Django app (API)
│ └── backend/ # Django project settings
├── frontend/ # Vue 3 + Vite frontend
│ ├── src/
│ │ ├── App.vue # Main Vue app entry
│ │ ├── main.js # JS entry point
│ │ ├── style.css # Global styles
│ │ ├── assets/ # Static assets
│ │ └── components/ # Vue components (e.g., HelloWorld.vue)
│ ├── public/
│ └── ...
├── requirements.txt # Python dependencies
└── README.md # This guide
This repository uses a branch-based workflow to support parallel development and maintain code quality. Below are the main branches and their purposes:
- main: The primary branch containing stable, production-ready code. All releases are tagged from this branch.
- addfeature: Used for developing new features. Each new feature should be developed in its own branch off of
mainor the latest stable branch, then merged via pull request. - bugfixes: Dedicated to addressing and resolving bugs. Hotfixes and patches should be committed here and merged into
mainafter review. - testing: Used for integration and system testing. Experimental changes and QA processes are performed here before merging into
main. - updates: Used for general updates, refactoring, or improvements that do not fall under features, bugfixes, or testing. Merge into
mainafter review.
Note: Always create descriptive feature or bugfix branches for specific tasks (e.g.,
feature/user-auth,bugfix/cart-total).
For questions, onboarding, or support, contact the project maintainer or your team lead.
Thank you for contributing to ShopnowEcommerce!!