The following project is an e-commerce platform built using the Django framework with a Model-View-Template (MVT) architecture. which replaces a monolithic architecture in order to improve scalability, reliability, and deployment efficiency. The following application includes core features such as product management, user authentication, shopping cart functionality, and order processing.
Kindly not and ensure you have the following installed on your machine:
git clone https://github.com/asifprog/ecommerce.git
cd ecommerce
./command.sh
source env/bin/activate
python manage.py runserver
Access the application at http://127.0.0.1:8000/.
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py generate_products
python manage.py seed_products
python manage.py runserver
Access the application at http://127.0.0.1:8000/.
Create the Super Admin Use the following command to create a super admin account:
python manage.py createsuperuser
Provide Super Admin Details You will be prompted to input the following:
admin
).Access the Admin Interface
python manage.py runserver
admin.py
file.cd theme/static_src
yarn or npm install
yarn or npm start # To start the tailwind server in development mode
Please note ensure that you have registered render account and linked to your github account
Dockerfile
.DEBUG
, DATABASE_URL
) in the Render dashboard.
```env
DJANGO_SECRET_KEY='xxxxxx'
DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0DB_NAME=your_database DB_USER=your_username DB_PASSWORD=your_password DB_HOST=localhost DB_PORT=5432
UNSPLASH_ACCESS_KEY='xxxxx'
### 3. Automatic deployments
- Render will automatically build and deploy the application on every push to the `main` branch using the linked GitHub repository.
## Docker for CI/CD
### Docker workflow
Render uses Docker to build and deploy the application automatically. The following Docker configuration ensures seamless CI/CD integration:
#### Dockerfile
```dockerfile
FROM python:3.9-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
libsqlite3-dev \
curl \
ca-certificates \
gnupg \
lsb-release \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
RUN node -v && npm -v
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# COPY .env .env
COPY theme/static_src/package.json theme/static_src/package-lock.json ./theme/static_src/
WORKDIR /app/theme/static_src
RUN npm install -g yarn && yarn install
WORKDIR /app
COPY . .
RUN python manage.py makemigrations
RUN python manage.py migrate
RUN python manage.py generate_products
RUN python manage.py seed_products
RUN python manage.py tailwind build
RUN python manage.py collectstatic
EXPOSE 8000
ENV DJANGO_SETTINGS_MODULE=ecommerce.settings
ENV PYTHONUNBUFFERED=1
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "ecommerce.wsgi:application"]
Below are some of the steps followed
Dockerfile
.The following code below is used to run the action for the Dockerfile on push to test the
name: Docker Image CI
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
Render provides built-in monitoring features, to check for changes as well as errors faced by the application.
Including:
ecommerce/
├── shop/*
│ ├── models.py
│ ├── views.py
│ ├── urls.py
│ ├── context_processors.py
│ ├── management/
│ │ ├── commands/*
├── ecommerce/
│ ├── settings.py
│ ├── urls.py
├── theme/
│ ├── apps.py
│ ├── urls.py
│ ├── static_src/
│ │ ├── src/*
│ │ │ ├── src/*
│ │ │ │ ├── package.json
│ │ │ │ ├── postcss.config.js
│ │ │ │ ├── tailwind.config.js
│ ├── templates/*
│ │ ├── base.html
├── requirements.txt
├── Dockerfile
└── README.md
Below are some of the pendding features to implement, as well as posible future changes to the application.
Checkout Process:
Kubernetes Support:
Search and Filtering:
Please note moste of the images generated are not related to the product name. it can be used for testing purposes as well as demonstation.