Skip to content

Django E-commerce is a unique marketplace focused on enabling users to buy/sell products directly or request/send quotes without any complicated or exhaustive process. This is the open-source version of a larger project.

License

Notifications You must be signed in to change notification settings

sa1if3/django_ecommerce

Repository files navigation

Django Ecommerce/Market

Django E-commerce is a unique marketplace focused on enabling users to buy/sell products directly or request/send quotes without any complicated or exhaustive process. This is the open-source version of a larger project.

Contents

  1. Features
  2. Installation
    1. Download the project
    2. Set Virtual Environment
    3. Configure .ENV Settings
    4. Async Tasks using Celery and Redis
    5. Debug Toolbar
    6. Migrate Database
    7. Create a superuser
    8. Collect static
  3. Run Development Server
  4. First Run and Initial Data
    1. Admin Section
    2. User Section
  5. Order Process
  6. Credits
  7. Screenshots

Features

  1. User Panel

    1. User Management
      • Sign Up
      • Log In
      • Email Password Reset
      • Email Verification
    2. Dashboard
    3. Item
      • Search (Category / Name)
      • Buy Item
      • Request Quote
      • Orders
        • Placed By User
        • Placed By Customer
      • Quote
        • Placed By User
        • Placed By Customer
        • Upload Pdf
          • By Customer
            • Purchase Order
          • By User/Seller
            • Quote
            • Invoice
            • Delivery Receipt
    4. Email Notifications: Enabled when EMAIL_SEND = True in settings.py
    5. SMS Notifications: Enabled when SMS_SEND = True in settings.py. Pingsms API
    6. Multiple Addresses: User addresses. One address can be set as default.
    7. Multiple Inventories: Each inventory must have an address.
    8. Item Listing: Each item is listed by against an inventory with visibility Public/Private.
    9. Shopping Cart
      • Checkout
      • TODO: Payment
    10. TODO: Chats and Notifications
  2. Admin Panel

    1. Item Types
    2. Items
    3. Weight Groups
    4. Addresses
    5. Inventories
    6. Listings
    7. Orders
    8. Quotes
    9. Shopping Carts

Installation

Download the project

git clone https://github.com/sa1if3/django_ecommerce

or

Download ZIP

Set Virtual Environment

Create a Virtual Environment

virtualenv venv

Activate Virtual Environment

source venv/bin/activate

Download Prerequisites using requirements.txt

pip install -r requirements.txt

Deactivate Virtual Environment

deactivate

Configure Settings

Create a .env file in project folder django_ecommerce and provide values for the following variables. In case you are not using Email or SMS. Those fields can be left empty.

SECRET_KEY=django-insecure-+_vcui795ns-2bl-$n)43ttpt6)s5s^2=t+8z*pv6%cqc*s)0i5
DB_NAME=
DB_USER=
DB_PASSWORD=
EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD=
PINGSMS_API_KEY=
PINGMS_SINGLE_SMS_TEMPLATE=
PINGMS_SENDER_ID=

Async Tasks using Celery and Redis

Install Redis in Ubuntu 20.04 by following this tutorial

In settings.py set the following variables. Change according to your use case.

BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Asia/Kolkata'

Activate Virtual Environment

source venv/bin/activate

Run Celery worker

celery -A django_ecommerce  worker -l info

[Note: In production, this command can be put in Supervisor]

Debug Toolbar

If you are interested in using the debug toolbar make sure to change your settings.py file with the appropriate IP.

DEBUG = True

INTERNAL_IPS = [
    # ...
    '127.0.0.1',
    # ...
]

Migrate Database

The project uses PostgreSQL. Make sure your settings.py is set to correct credential.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'farmersmarket',
        'USER': 'farmersmarketuser',
        'PASSWORD': 'fkfQbfu6gnhGt',
        'HOST': 'localhost',
        'PORT': '',
    }
}

Section A of my tutorial covers the setting up of a server part for Django development.

Run

python manage.py makemigrations

Followed by

python manage.py migrate

Create a superuser

A superuser is required to access the admin panel located at /accounts

python manage.py createsuperuser

Collect static

In case static files don't run properly simply run

python manage.py collectstatic

Run Development Server

To start the project simply run the server with this command inside the activated virtual environment.

python manage.py runserver

First Run and Initial Data

Admin Section

Go to http://yourdomain.com/accounts and log in as a superuser. The admin needs to set up some initial data which restricts the user to sell items from the given category only. Enter data in the following order

  1. Create Item Types: Type of item being sold Item Type
  2. Create Items: Each Item has an item type Item
  3. Create Weight Groups: Used during the listing, quote request and orders Weight Group

User Section

A seller also needs to set up some initial data to list their items.

  1. Create Address: Used for Inventory and invoices

  2. Create Inventory: Used for Listing items. The name is shown to the buyer too.

  3. Create Listing: List items for personal use view status as Private or public to view and purchase by setting the view status as Public. If all the items of a listing were sold off; the listing becomes automatically private and the seller is notified via email. The seller cannot search for their listings.

Order Process

Buy/Sell

  1. Search
  2. Add to Cart
  3. Check Out
  4. View Order Invoice

Quotes

  1. Search
  2. Request Quote
  3. Seller Uploads Quote
  4. Buyer Uploads Purchase Order
  5. Seller Uploads Invoice and Delivery Receipt

Credits

AdminLTE

unDraw

pixabay

Screenshots

Sign Up Email Verification
Dashboard
Search
Log In Address
Checkout Inventory

About

Django E-commerce is a unique marketplace focused on enabling users to buy/sell products directly or request/send quotes without any complicated or exhaustive process. This is the open-source version of a larger project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published