Skip to content

Django Full-Stack ecommerce website using Celery, Redis, Docker, Nginx, Stripe, DRF, HTMX, JS and etc.

Notifications You must be signed in to change notification settings

faizan35/fullstack-ecommerce

 
 

Repository files navigation

Full Stack Ecommerce using Django

Full-Stack Django ecommerce project.

Features

  • Faker generate fakeproducts
  • API support with Swagger and Redoc documentation
  • Celery with Redis, Celery beat and Flower
  • Docker-compose for Nginx, Gunicorn, PostgreSQL, Celery, Redis and etc.

Steps to run it in local Env

Prerequisite


1. Clone this repo.

git clone https://github.com/faizan35/fullstack-ecommerce.git

2. Create you virtual env

  • This is for windows, Execute there incide cmd.
cd fullstack-ecommerce

pip install virtualenv

python -m venv myenv
myenv\Scripts\activate

3. Install Project Dependencies

  • Same, in cmd terminal
cd core

pip install -r requirements.txt

4. Configure PostgreSQL Database

  • Inside SQL Shell (psql)
CREATE USER myuser WITH PASSWORD "mypassword";
CREATE DATABASE mydb OWNER myuser;
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;

5. Create .env file in the root dir

POSTGRES_DB=mydb
POSTGRES_USER=myuser
POSTGRES_PASSWORD=mypassword
POSTGRES_HOST=db
# POSTGRES_HOST=localhost

[email protected]
EMAIL_HOST_APP_PASSWORD=fake_pass

STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_API_VERSION=
STRIPE_WEBHOOK_SECRET=

YOOKASSA_SECRET_KEY=actualyourdata
YOOKASSA_SHOP_ID=actualyourdata

CELERY_RESULT_BACKEND=redis://localhost:6379/0
CELERY_BROKER_URL=redis://localhost:6379/0

Copy all this inside the env file, Only env values you need is of Stripe"s. We are NOT using YOOKASSA in this project.

How to find Strip"s env values

  • STRIPE_PUBLISHABLE_KEY: Can find in the Stripe Dashboard.

  • STRIPE_SECRET_KEY: Can find in the Stripe Dashboard.

  • STRIPE_API_VERSION: Can find in the Stripe Dashboard.

  • STRIPE_WEBHOOK_SECRET: Find Webhook

6. Start your Database and Redis Server.

Database

  • Open your UI of Database

Redis Server

sudo service redis-server start

or

sudo systemctl start redis-server
  • redis-cli ping for verification, You will get PONG if it working.

7. Start your Stripe CLI WebHook

  • Navigate to the dir where you have installed stripe cli.
  • Open cmd in that path and execute
stripe listen --forward-to localhost:8000/payment/stripe-webhook/

8. Execute these commands one by one

python manage.py migrate

python manage.py fakeproducts

python manage.py collectstatic --noinput

python manage.py runserver

8. You E-comm Web App would be running on:


Steps to run it in container env (Docker)

< --- Documentations Under Process --- >

For env

POSTGRES_HOST=db

CELERY_RESULT_BACKEND=redis://redis:6379/0
CELERY_BROKER_URL=redis://redis:6379/0

To get insite db container

docker exec -it your_postgres_container_name /bin/bash
psql -U myuser -d mydb
$ docker images
REPOSITORY                        TAG            IMAGE ID       CREATED             SIZE
fullstack-ecommerce-celery        latest         00f3e2f91984   About an hour ago   909MB
fullstack-ecommerce-celery-beat   latest         dede52007b1b   About an hour ago   909MB
fullstack-ecommerce-backend       latest         141b947b999c   About an hour ago   909MB
nginx                             latest         39286ab8a5e1   4 weeks ago         188MB
redis                             7.2.3-alpine   d2d4688fcebe   9 months ago        41MB
postgres                          13.0-alpine    700e581c202e   3 years ago         159MB

DockerHUB images

faizan44/fullstack-ecommerce-backend faizan44/fullstack-ecommerce-celery faizan44/fullstack-ecommerce-celery-beat


CI/CD Pipeline with Jenkins

WebHook

  • Appent this after IP: http://<IP>:8080/github-webhook/

About

Django Full-Stack ecommerce website using Celery, Redis, Docker, Nginx, Stripe, DRF, HTMX, JS and etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 60.7%
  • HTML 30.3%
  • CSS 6.2%
  • JavaScript 1.6%
  • Other 1.2%