This is a single vendor ecommerce api developed with Django(DRF) and a PostgreSQL database.
- Overview
- Features
- Settings.py
- Readme Files
- Project Apps
- Run the Project
- Some helpful extra documentation to read
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
- 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
-
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
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.
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.
-
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
Steps for running the project locally:
- Install python3.8 and pip3
- Install postgreSQL and create database
- Install packages from requirements.txt
- Create virtualenv
- Create .env file and add the variables specified in the Settings.py File Section
- Run the migrations
- Run server