Ceci-Aguilera / ecommerce_api_django

This is a Single Vendor Ecommerce API developed with Django (DRF) and using a PostgreSQL database.

Repository from Github https://github.comCeci-Aguilera/ecommerce_api_djangoRepository from Github https://github.comCeci-Aguilera/ecommerce_api_django

Single Vendor Ecommerce Django (API)

This is a single vendor ecommerce api developed with Django(DRF) and a PostgreSQL database.

Table of Contents

Overview

This project is intended as an abstract template for any Single Vendor Ecommerce Website, and so it is divided in three different apps, one that manages user account's creation and updating, the second that manages the store sales and payments, and the third app that is only available for the store owner (Admin User) to have control over the store and users

Features

User account management features:

  • User Account's Activation functionality via email (the url sent to the user email gets invalid after it is accessed from the browser for the first time)
  • Password Reset functionality is implemented with same method as User Account's Activation
  • The User can save payment info such as
    • Stripe account info and
    • Default billing/shipping address to make automatic payments without the need of entering any data during checkout.
  • The User can
    • Update both personal and payment information,
    • See payment and order history and ask for refund, and
    • Have multiple billing and shipping addresses

Store sales features:

  • The customer can

    • Be either a logged user or an anonymous user (all features are available for both except user account management functionalities),
    • Filter products by category and/or filter by giving a keyword or any keyword substring,
    • View the details and set the amount of the product before add it to the cart
  • Cart functionalities such as Add item, Modify amount of item, Delete item, and Delete cart are available

  • Customer is always given the option to change the payment info during checkout (previous to make the payment). The user can change the default billing/shipping address to any other address created previous the checkout or else can choose to create a new one

  • Payments are handled via stripe. Anonymous users can also make a purchase

  • Refunds can be asked for any completed (already paid) order

Settings.py

The settings.py has been replaced with the files base.py, development.py, and production.py inside of the settings folder, i.e., the settings folder has the following files inside:

  • __init__.py
  • development.py
  • production.py
  • base.py
  • .env

Hence, each environment has a different settings configuration, but they all have the base.py file as base template.

The current setting file in use is specified in settings/__init__.py file.

Environment variables for development.py had been set in the .env file inside the settings folder using the django-environ package.

The .env file should contain the following variables:

  • SECRET_KEY
  • DATABASE_NAME
  • DATABASE_USER
  • DATABASE_PASSWORD
  • DATABASE_HOST
  • DATABASE_PORT
  • EMAIL_HOST_USER
  • EMAIL_HOST_PASSWORD
  • STRIPE_PUBLIC_KEY
  • STRIPE_SECRET_KEY

The default authentication method used is knox tokens authentication.

Readme Files

Inside the Readme folder of each app are the Readme-{some topic}.md files of the app for explaining models, views, serializers, ... only when considered required.

Project Apps

  • The ecommerce_backend manages the client iteration with the products of the store, i.e., view a product, add it to the cart, buy it, apply for refund and coupons. It also handles all related to payments and store services.

  • The eccommerce_accounts_app manages the user-client operations such as login/out, sign up and edit user credentials and data of the user account and also view its orders. This also manages the admin (store owner) account and allows it to make CRUD operations over the products (and models as Category, Coupons, Orders, Refunds, ...) of the store.

  • The ecommerce_administration_app acts like a User Management System for the store, so the Admin User can access and modify/create data such as products, orders, ... . It also displays some statistics from the sales as yearly, monthly, and weekly and keeps the record of the Users and Payments

Run the Project

Steps for running the project locally:

  1. Install python3.8 and pip3
  2. Install postgreSQL and create database
  3. Install packages from requirements.txt
  4. Create virtualenv
  5. Create .env file and add the variables specified in the Settings.py File Section
  6. Run the migrations
  7. Run server

Some helpful extra documentation to read

About the Knox Authentication Tokes : django-rest-knox official documentation at Github

How to customize stripe implementation : Stripe official documentation for Developer Tools

Miscellaneous:

About

This is a Single Vendor Ecommerce API developed with Django (DRF) and using a PostgreSQL database.


Languages

Language:Python 99.4%Language:HTML 0.6%