django_ecommerce
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
- Features
- Installation
- Run Development Server
- First Run and Initial Data
- Order Process
- Credits
- Screenshots
Features
-
User Panel
-
User Management
- Sign Up
- Log In
- Email Password Reset
- Email Verification
<li> Dashboard </li> <li> Item <ul dir="auto"> <li> Search (Category / Name) </li> <li> Buy Item </li> <li> Request Quote </li> <li> Orders <ul dir="auto"> <li> Placed By User </li> <li> Placed By Customer </li> </ul> </li> <li> Quote <ul dir="auto"> <li> Placed By User </li> <li> Placed By Customer </li> <li> Upload Pdf <ul dir="auto"> <li> By Customer <ul dir="auto"> <li> Purchase Order </li> </ul> </li> <li> By User/Seller <ul dir="auto"> <li> Quote </li> <li> Invoice </li> <li> Delivery Receipt </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> <li> Email Notifications: Enabled when <code>EMAIL_SEND = True</code> in <code>settings.py</code> </li> <li> SMS Notifications: Enabled when <code>SMS_SEND = True</code> in <code>settings.py</code>. <a rel="nofollow noopener" target="_blank" href="https://pypi.org/project/pingsms-api/">Pingsms API</a> </li> <li> Multiple Addresses: User addresses. One address can be set as default. </li> <li> Multiple Inventories: Each inventory must have an address. </li> <li> Item Listing: Each item is listed by against an inventory with visibility Public/Private. </li> <li> Shopping Cart <ul dir="auto"> <li> Checkout </li> <li> TODO: Payment </li> </ul> </li> <li> TODO: Chats and Notifications </li> </ol>
-
User Management
-
Admin Panel
- Item Types
- Items
- Weight Groups
- Addresses
- Inventories
- Listings
- Orders
- Quotes
- 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
- Create Item Types: Type of item being sold
- Create Items: Each Item has an item type
- Create Weight Groups: Used during the listing, quote request and orders
User Section
A seller also needs to set up some initial data to list their items.
- Create Address: Used for Inventory and invoices
- Create Inventory: Used for Listing items. The name is shown to the buyer too.
-
Create Listing: List items for personal use view status as
Private
or public to view and purchase by setting the view status asPublic
. 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
- Search
- Add to Cart
- Check Out
- View Order Invoice
Quotes
- Search
- Request Quote
- Seller Uploads Quote
- Buyer Uploads Purchase Order
- Seller Uploads Invoice and Delivery Receipt
Credits
Screenshots
Sign Up
Email Verification
Dashboard
Search
Log In
Address
Checkout
Inventory