ChoLon

Geeky Nov 18, 2022

 ChoLon is an E-Commerce Store using Django as the framework, Nextjs as the frontend and PostgreSQL as the backend.

 I recently started this project from beginning of this month and will update this post regularly.

 Here is what I have done so far:

  • Use Django virtual environment
  •  pip install virtualenv
  •  virtual myenv
  •  source myenv/bin/activate
  • Create Django app
  •  pip install django
  •  mkdir cholon
  •  cd cholon
  •  django-admin startproject backend
  •  pip install boto3 django-cors-headers django-dotenv django-filter django-storages djangorestframework djangorestframework-simplejwt geocoder gunicorn whitenoise psycopg2 dj-database-url
  • Connect to database of PostgreSQL (hosted on local machine)
  •  Debug : missing psycopg2
  •   Install psycopg2 : pip install psycopg2-binary
  • Create admin account for django administration endpoint
  •  python manage.py createsuperuser
  • Run project
  •  source myend/bin/activate
  •  cd cholon/backend
  •  python manage.py make migrations
  •  python manage.py migrate
  •  python manage.py runserver (default port is 8000)
  • Backend (Camel-cased)
  •  Models
  •   Customers - customer info (address, shipping address, billing address,..)
  •   Products - product info (name, description, size, color,..)
  •   Orders - info when an order was placed (customer id, date of order, order shipping date)
  •   Order Details - info on each product ordered on one order  (product ordered, quantity, unit price, discount)

Table

Primary Key

Related Table and its Primary Key

Suppliers

SupplierID

Products - ProductID

Products

ProductID

Category - CategoryID

Orders

OrderID

OrderDetails - OrderDetailsID

Customers

CustomerID

Order - OrderID

Shippers

ShipperID

Order - OrderID

Payment

PaymentID

Order - OrderID


  • Debug
  •  PostgreSQL: there is no unique constraint matching given keys for referenced table
  •   Fix: the variable referenced has to be either primary key or unique
  •  Nextjs: Client_id is required → .env.local is not reachable to Nextjs files and therefore authentication failed
  •   Fix: Merge files in google-v1 to root directory

 Here is the repos of the project where you can see the code

GitHub - leestorm4520/Cho-Lon
Contribute to leestorm4520/Cho-Lon development by creating an account on GitHub.

Tags