notarious2 / Django-Pizza-Delivery

Django 4.0, JS, Ajax and Tailwind CSS built Pizza Website for Carryout and Delivery, Cash payment option and Stripe Payment Integration, as well as Guest checkout feature. Product may contain multiple size variations with different prices. Website allows to use Coupon codes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django Pizza Delivery App

Live Demo

Visit https://notarious2.pythonanywhere.com/

Front page

Admin credentials:

https://notarious2.pythonanywhere.com/admin/

login: admin/admin@example.com
password: admin

This e-commerce app was built using the following technologies:

Django TailwindCSS Stripe JQuery

Features

  • Customer Registration, Login and Logout. Customers may login with either email or username

  • Customer and Guest Checkout (using device ID set in Cookies)

  • Delivery and Carry-out option

  • Special Orders tab for registered users to view completed orders

  • Deferred Cash payment and Instant online payment with Stripe

  • 99% test coverage with 100+ of both functional and unit tests

SQL Relational Schema

The app uses SQLite database. Relational representation of Django Models used in ePizza app are provided below.

SQL model

Coupons

3 coupons (integrated with Stripe Payment Gateway) are available at Checkout

WINTER: 50% off the order total

SUMMER: $10 off the order total

App Setup

Clone Repository:

git clone https://github.com/notarious2/Django-Pizza-Delivery.git
cd Django-Pizza-Delivery

Configure Environmental variables:
inside 'epizza' folder add .env file and add Secret Key, Stripe Publishable Key and Stripe Secret Key:

SECRET_KEY=
STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=

To test Stripe's Percent Coupon (otherwise tests are automatically skipped) add:

STRIPE_COUPON_ID_PERCENT=

Create and Activate Virtual Environment:

virtualenv env
env\Scripts\activate

Install Dependencies:

pip install -r requirements.txt

Run Development Server:

python manage.py runserver

Tailwind CSS Setup

You must have Node.js installed in your PC
Tailwind Directives are in store/static/store/src/input.css
Output (autogenerated) stored in store/static/store/src/styles.css

Install Dependencies:

npm install

Start Tailwind CLI build process

runs: "tailwind build -i store/static/store/src/input.css -o store/static/store/src/styles.css --watch" Script inside package.json

npm run build

Functional and Unit Tests

The project contains 60+ both functional and unit tests.

Unit tests cover urls, models, forms and views

Functional testing is done using Selenium and django's StaticLiveServerTestCase

Run all tests

python manage.py test

Run functional tests

Located in functional tests folder of a root directory. to see the testing process remove options.add_argument('headless') in SetUp of each functional test

python manage.py test functional_tests

Run unit tests

python manage.py test users store orders

Test coverage report

coverage run manage.py test

to show report in command line:

coverage report

generates html report in test_coverage_report folder

coverage html

About

Django 4.0, JS, Ajax and Tailwind CSS built Pizza Website for Carryout and Delivery, Cash payment option and Stripe Payment Integration, as well as Guest checkout feature. Product may contain multiple size variations with different prices. Website allows to use Coupon codes.


Languages

Language:CSS 36.2%Language:Python 31.1%Language:JavaScript 21.1%Language:HTML 11.7%