[go: up one dir, main page]

0% found this document useful (0 votes)
24 views65 pages

Documentation (218609p)

The document is an internship report detailing the development of a fully functional e-commerce web application using Python and Django, submitted by B.S.L. Sravya for the Bachelor of Computer Science degree. It includes an abstract, project aims and objectives, existing system analysis, proposed system features, hardware and software requirements, a data dictionary, and technologies used. The project focuses on creating a user-friendly platform for online shopping with features such as user authentication, product management, and secure payment integration.

Uploaded by

Mandadi narendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views65 pages

Documentation (218609p)

The document is an internship report detailing the development of a fully functional e-commerce web application using Python and Django, submitted by B.S.L. Sravya for the Bachelor of Computer Science degree. It includes an abstract, project aims and objectives, existing system analysis, proposed system features, hardware and software requirements, a data dictionary, and technologies used. The project focuses on creating a user-friendly platform for online shopping with features such as user authentication, product management, and secure payment integration.

Uploaded by

Mandadi narendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

An Internship report on

BUILDING A FULLY FUNCTIONAL E-COMMERCE WEB


APPLICATION USING PYTHON

Submitted in partial fulfilment of the


Requirements for the award of the Degree of

BACHELOR OF COMPUTER SCIENCE (BSC)

By

B.S.L.SRAVYA (218609P)

Under the esteemed guidance of

V. JHANSI LAKSHMI, MCA,M.Tech


Lecturer, Department of Computer Science

DEPARTMENT OF COMPUTER SCIENCE

P. B. SIDDHARTHA COLLEGE OF ARTS AND SCIENCE


VIJAYAWADA – 10

An Autonomous college under the jurisdiction of Krishna University, Machilipatnam.

(A college with potential for excellence; Re – accredited at the level ‗A+‘ by NAAC, Bangalore)
2023-2024

1
P. B. SIDDHARTHA COLLEGE OF ARTS AND SCIENCE

VIJAYAWADA-10

An Autonomous college under the jurisdiction of Krishna University, Machilipatnam.


(A college with potential for excellence; Re-accredited at the level ‗A+‘ by NAAC, Bangalore)

DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE
This is to certify that the project entitled “BUILDING A FULLY
FUNCTIONAL E-COMMERCE WEB APPLICATION USING
PYTHON”, is a bonafide work of B.S.L.SRAVYA (218609P) submitted in
partial fulfilment of the requirements for the award of the degree of
BACHELOR OF COMPUTER SCIENCE (BSC) from P.B. Siddhartha
College of Arts and Science, Vijayawada.

V. Jhansi Lakshmi ,MCA,M.Tech


Project Guide K. Sudhir M.Sc(IT). M.Tech
Head of the Department
Department of Computer Science

External Examiner

2
3
BUILDING A FULLY FUNCTIONAL E-COMMERCE WEB
APPLICATION USING PYTHON

4
ABSTRACT

An e-commerce online project in Django is a web application that allows users to buy and
sell products online. It typically includes features like user registration and authentication,
product listing and search, shopping cart functionality, order management, and payment
integration.

An ecommerce web application is basically a website that allows people to buy and sell
products online. It's like having a virtual store where you can browse through different
products, add them to your cart, and make purchases right from the comfort of your own
home. These web applications usually have features like secure payment gateways, product
listings, search functionality, and user accounts to track orders and manage personal
information. It's a convenient way to shop and sell items without having to physically visit a
store.
In Django, you can use the built-in authentication system to handle user registration and
login. You can create models to represent products, categories, and orders, and use views
and templates to display and manage these data.For product listing and search,you can
implement search functionality using Django's query capabilities and create views todisplay
product details and images. You can also add features like product reviews and ratings.

To handle shopping cart functionality, you can use sessions or cookies to store the
selected products and quantities. You can create views to add, remove, and update items in
the cart, and implement the checkout process.For order management, you can create models
and views to handle order creation, status updates, and shipping information. You can also
integrate payment gateways like PayPal or Stripe to handle online payments.
Overall, Django provides a robust framework for building e-commerce
websites with features like user management, product catalog, shopping cart, and payment
integration. It's a great choice for developing scalable and secure online stores.

5
ACKNOWLEDGEMENTS

With great pleasure I want to take this opportunity to express my heartfelt gratitude to all the
people who helped in making this project work a grand success.

First of all I would like to express my profound sense of gratitude to the Principal

Dr.M. Ramesh for giving me the permission to carry out this project.

I express my deep gratitude and regards to Mr.K.Sudhir, M.Sc(IT). M.Tech


Head of the Department of Computer Science, and project guide,
V.Jhansi Lakshmi, MCA,M.Tech for their encouragement and valuable guidance in
bringing shape to this dissertation.
I am thankful to all the Technical Staff and Non-Teaching Staff in the department for their
teaching and academic support.

B.S.L.SRAVYA (218609P)

6
TABLE OF CONTENTS

1. Introduction 8-9
 Project Aims and Objectives
 Background of project

2. Existing system and Demerits 10

3. Proposed system 11 - 12
 Advantages of proposed system
 Available features

4. Hardware and software requirements 13

5. Data Dictionary 14

6. Technologies Used 15 - 17

7. System Requirement Specification 18 - 19


 SRS Document
 Functional requirements
 Non functional requirements

8. System Design 20 - 24
 Introduction to design
 Unified Modelling Language Diagrams

9. UML diagrams 25 - 27

10. Coding and Implementation 28 - 50

11. Software Testing 51 - 53


 Types of testing
 Test cases

12. Output Screens 54 - 62

13. Future scope 63


14. Conclusion 64
15. Bibliography 65
7
1.INTRODUCTION

PROJECT AIMS AND OBJECTIVES


The project aims and objectives that will be achieved after completion of this project are
discussed in this subchapter. The aims and objectives are as follows:

AIM

The primary aim of an e-commerce Django project is to develop a robust and user-friendly
online platform that facilitates the buying and selling of products or services. This involves
creating a secure, scalable, and efficient web application using the Django framework, with
features such as user authentication, product management, shopping cart functionality, and
seamless transaction processing. The project aims to provide a positive and engaging user
experience, ensuring cross-platform compatibility and adherence to security best practices.

OBJECTIVES

● Create a User-Friendly online store : Aim to design and develop an intuitive and user-
friendly interface for the online store. Focus on providing a seamless and enjoyable
shopping experience for customers.
● Implement User Authentication and Authorization : Objective to create a secure user
authentication system. Define user roles and permissions for different types of users
(e.g., customers, administrators).
● Develop Product Catalog : Objective to create a well-organized product catalog with
features like product details, images, and pricing. Implement search and filtering
options for better navigation.
● Build a Shopping Cart : Objective to implement a shopping cart system that allows
users to add, edit, and remove items. Provide a clear and transparent checkout
process.
● Implement Order Processing : Objective to develop order processing functionality,
including order confirmation, tracking, and status updates. Send order confirmation
emails to customers.

8
BACKGROUND OF PROJECT
The background of an e-commerce Django project typically involves a combination of
market demands, business goals, technological considerations, and other factors that motivate
the development of an online shopping platform using the Django framework. Here's a brief
description of the background for an e-commerce Django project:

Technology Upgrade and Competitive Landscape : The project's background may also
involve a desire to upgrade or transition from legacy systems to modern, scalable, and
efficient technology platforms. Django, known for its robustness and flexibility, is chosen as
the preferred framework for web application development. Additionally, the competitive
landscape plays a crucial role, with the business seeking to stay competitive by offering a
feature-rich and user-friendly online shopping experience comparable to or better than
competitors.

Customer Convenience and Security Concerns: Understanding the shift in consumer behavior
towards online shopping, the project aims to provide a seamless and user-friendly interface
that enhances customer convenience. Simultaneously, there is a recognition of the importance
of addressing data security concerns. Secure online transactions and compliance with
industry standards for data protection are key considerations in the project's background.

Rise of E-commerce: The continuous growth of online commerce has become a dominant
trend in retail, prompting businesses to establish an online presence to reach a broader
audience.

Consumer Behavior Shift: Changes in consumer behavior, with a preference for online
shopping, have encouraged businesses to adapt and offer a seamless digital shopping
experience.

9
2.EXISTING SYSTEM AND DEMERITS

EXISTING SYSTEM

The existing system likely includes features for managing products such as adding,
updating, and removing items. It may have tools for categorizing products, setting prices,
and managing inventory. As of my last knowledge update in January 2022, several e-
commerce systems and platforms were widely used across various industries. Keep in
mind that the popularity and landscape of e-commerce platforms may have evolved since
then.

DEMERITS
● Customization Complexity : Highly customized e-commerce requirements may
increase the complexity of the project, requiring more effort for customization and
integration.
● Integration Challenges : Integrating with third-party services, such as payment
gateways and shipping providers, may pose challenges due to variations in APIs and
compatibility.
● Security Risks : Like any web application, an e-commerce site built with Django may
be susceptible to security risks, especially if best practices are not followed.
● Responsive Design Challenges : Achieving a fully responsive design across various
devices may pose challenges, leading to inconsistencies in user experience.
● User Experience Variability : User experience may vary depending on the skill and
design choices of different developers, leading to inconsistencies.
● Rapid Technological Changes: The fast-paced evolution of technology may require
continuous updates and adaptations to keep the platform aligned with the latest trends
and user expectations.

10
3.PROPOSED SYSTEM

In our proposed system, we have developed a ecommerce web application project using
Django, which aims to provide a platform for users to buy products, add products to cart,
order the products and write reviews on them.

The main features of our application include:

● Shopping Cart and Checkout Process: Design a user-friendly shopping cart where
customers can easily add, update, and remove items. Implement a streamlined and
secure checkout process with multiple payment and shipping options.
● Reviews on products: Users can write reviews for the products that they have ordered
and rate them based on their experience. This enables others to make informed
decisions about which products to order.
● Order Processing: Create an efficient order processing system for administrators to
manage orders, update order statuses, and send order confirmations. Provide users
with real-time order tracking and status notifications.
● Contact Form: Includes a user-friendly contact form with fields for essential
information such as name, email address, subject, and message. A structured form
ensures that users provide necessary details, streamlining the communication process.

● FAQ Section: Include a tab to the Frequently Asked Questions (FAQ) section, guiding
users to self-help resources before contacting support.Encourages users to find
answers independently, reducing the volume of routine inquiries.

Overall, The proposed e-commerce Django project envisions a modern, secure, and scalable
platform that prioritizes user experience, efficient management for administrators, and
adherence to industry standards for online transactions. Regular updates and improvements
ensure that the platform stays competitive and aligned with evolving business needs and
technological advancements.

ADVANTAGES OF PROPOSED SYSTEM


The proposed system for an e-commerce Django project comes with several advantages that
aim to improve various aspects of the platform, enhance user experience, and facilitate
efficient management. Here are the advantages of the proposed system:

11
● Advanced Product Management : Enhanced product management features, including
efficient categorization and bulk editing, provide administrators with powerful tools
for maintaining an up-to-date and well-organized product catalog.
● Streamlined Shopping Cart and Checkout : The streamlined shopping cart and
checkout process reduce friction for users, leading to higher conversion rates and
improved customer satisfaction.
● Efficient Order Processing : An efficient order processing system benefits both
customers and administrators by providing real-time order tracking, order status
updates, and streamlined order management.
● Secure Online Transactions : Integration with secure payment gateways and
adherence to security best practices ensure secure online transactions, instilling
confidence in users and meeting industry standards.
● User-Friendly Interface: The application offers a user-friendly interface, making it
easy for individuals of all technical backgrounds to navigate and interact with the
system. Intuitive design elements and clear instructions contribute to a seamless user
experience.

Overall, the proposed system for the ecommerce web application project developed using
Django enhances product management, streamlined shopping cart and checkout, efficient
order processing, secure online transactions and offers a convenient way to order
products while ensuring an engaging and user-friendly experience.

AVAILABLE FEATURES
● User Registration and Authentication: Allow users to create accounts and log in
securely. Implement password reset functionality to help users regain access to their
accounts if needed.
● Product Browsing : Users can browse products through a user-friendly interface with
search and filtering options. Enhances the shopping experience by helping users find
products efficiently.
● Shopping cart : Users can add, update, or remove items in their shopping cart before
proceeding to checkout. Offers a convenient way for users to manage their selected
items before purchase.
● Product Catalog Pages : Detailed product pages display essential information,
including images, descriptions, prices, and user reviews. Allows users to make
informed purchase decisions and builds trust.
● Secure Transactions : Integration with secure payment gateways and the use of
HTTPS for secure data transmission. Protects customer data and instills trust in online
transactions.

12
4.HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARE REQUIREMENTS

1. Computer: Any modern computer capable of running Django and supporting development
tools.

2. Processor: A multi-core processor for faster performance.

3. RAM: At least 8 GB of RAM to ensure smooth development experience.

4. Storage: Sufficient storage capacity for the Django project files and any additional media
files (e.g., food images).

SOFTWARE REQUIREMENTS

1. Operating System: Windows

2. Python: Install the Python version 3.9

3. Django: Installed the latest version of Django framework using pip, the Python package
installer.

4.Visual Studio: Installed the latest version of visual studio code for Coding

5. Web Browser: Use a web browser like Google Chrome for testing and previewing the
application.

6. Version Control System: Set up Git or any other version control system to track your
code changes and collaborate with other developers if needed.

7.Github: Used to push the project into github for further accessing

8.Pythonanywhere: Used for deployment of the project

Additional Libraries and Packages:

Django Packages: Install additional Django packages like django-crispy-forms, django-rest-


framework, and django-allauth for enhanced functionality.

13
5.DATA DICTIONARY

In the fully functional ecommerce web application project developed using Django and
Visual Studio, a data dictionary is used to define and describe the various data entities and
their attributes used in the application.
Here's some of a data dictionary‘s:

1. Product :

Attributes:

- id: Unique identifier for the product.


- name: Name of the product.
- description: Description of the product.
- price: Price of the product.
- stock quantity: Quantity of the product available in stock.
-category: Category to which the product belongs.

2. Review:

Attributes:

- id: Unique identifier for the review.


- product id: Foreign key referencing the Products table.
- user id: Foreign key referencing the Users table.
- comment: User's comment or review text.
- created at: Date and time when the review was submitted.

3. User:

Attributes:

- id: The unique identifier for the user.


- username: The username of the user.
- email: The email address of the user.
- password: The encrypted password of the user.
- first_name: The first name of the user.
- last_name: The last name of the user.

14
6.TECHNOLOGIES USED

DJANGO

Django is a web framework written in Python that follows the model-view-controller (MVC)
architectural pattern. It provides a set of tools and libraries for building web applications
efficiently. Django's main features include a robust URL routing system, an ORM for
database operations, a templating engine for rendering HTML, and built-in support for user
authentication and session management.

PYTHON

Python is a versatile and beginner-friendly programming language known for its readability
and simplicity. It has a large and active community, extensive libraries, and frameworks that
make it suitable for web development, data analysis, and many other applications. Python is
the language used to write Django, and it serves as the backbone for developing the fully
functional ecommerce web application project.

HTML/CSS

HTML is a markup language used for structuring the content and layout of web pages. It
provides a way to define the structure of elements on a web page, such as headings,
paragraphs, images, and forms. CSS is a style sheet language that defines the visual
presentation of HTML elements, including colours, fonts, layouts, and animations. HTML
and CSS are the core technologies used for creating the user interface of the fully functional
ecommerce web application project.

JAVASCRIPT

JavaScript is a programming language commonly used for adding interactivity and dynamic
behaviour to web pages. With JavaScript, you can handle user events, manipulate the DOM
(Document Object Model), perform asynchronous operations like AJAX requests, and create
interactive features such as form validation. In the fully functional ecommerce web
application project., JavaScript can be used to enhance the user experience and provide
interactive elements.

15
BOOTSTRAP

Bootstrap is a popular front-end framework that provides a collection of CSS and JavaScript
components. It offers a responsive grid system, pre-styled UI elements (e.g., buttons, forms,
navigation bars), and JavaScript plugins (e.g., modals, carousels). By using Bootstrap,
developers can quickly create a visually appealing and mobile-friendly user interface for the
fully functional ecommerce web application project.

DJANGO REST FRAMEWORK

Django Rest Framework (DRF) is a powerful toolkit for building web APIs using Django. It
simplifies the process of creating RESTful endpoints for data retrieval, modification, and
deletion. DRF provides features like serialisation/deserialization, authentication, pagination,
and versioning, making it easier to develop an API for your fully functional ecommerce web
application project.

DJANGO AUTHENTICATION SYSTEM

Django comes with a built-in authentication system that provides user registration, login,
logout, and password reset functionality. It handles user sessions, password hashing, and
security measures like CSRF (Cross-Site Request Forgery) protection. You can leverage
Django's authentication system to implement user account creation, email verification, and
secure user authentication for the fully functional ecommerce web application project.

DJANGO ORM

Django's ORM (Object-Relational Mapping) is a powerful tool that allows developers to


interact with the database using Python objects. It abstracts away the need to write raw SQL
queries and provides a higher-level API for managing database models, performing database
operations (e.g., CRUD), and handling database migrations. The ORM makes it easier to
work with the database and ensures database independence by supporting multiple database
backends.

POSTGRESQL

Django supports various databases, and PostgreSQL is a popular choice due to its reliability,
performance, and advanced features like support for JSON data and spatial queries. You can
use PostgreSQL to store and retrieve data related to Products, user accounts, reviews, and
other entities in the fully functional ecommerce web application project.

16
SMTP EMAIL BACKEND

Django has built-in support for sending emails, and it provides an SMTP email backend that
allows you to send email messages via an SMTP server. You can configure the SMTP email
backend to send verification emails to users for email verification during the account creation
process in the fully functional ecommerce web application project.

GIT

Git is a distributed version control system widely used in software development projects. It
allows multiple developers to collaborate on a codebase, track changes, and merge code
changes seamlessly. With Git, you can create branches for different features or bug fixes,
revert changes if needed, and ensure the integrity of the codebase. Using Git facilitates
effective code management and collaboration among developers working on the fully
functional ecommerce web application project.

17
7.SYSTEM REQUIREMENT SPECIFICATIONS

SRS DOCUMENT
The SRS typically contains the brief description of the project. The purpose of the
requirement document is to specify all the information required to design, develop and test
the software. The purpose of developing an e-commerce web application is to create a
platform that facilitates online buying and selling of goods and services.

FUNCTIONAL REQUIREMENTS

● User Registration and Authentication: Users should be able to register and create an
account. Users should be able to log in to their accounts using their credentials. User
authentication and authorization should be implemented to ensure secure access.
● Product Management and Catalog: Users should be able to browse and search for
each product which is having a detailed and informative description that highlights its
features, specifications, and benefits. High-quality images, showcasing the product's
appearance and details. Products should be organized into categories and
subcategories for easy navigation.
● Shopping Cart: Users can add products to the shopping cart by clicking an "Add to
Cart" button. Product details, including name, price, and quantity, are recorded in the
shopping cart. Users can adjust the quantity of each item in the cart, enabling them to
increase or decrease the number of units they wish to purchase. Users have the option
to remove items from the cart if they change their minds or wish to modify their
selections.
● Checkout Process: Users initiate the checkout process by reviewing the contents of
their shopping cart. Users may be prompted to log in to an existing account or
proceed as a guest. Registered users can access saved addresses and payment
information, while guest users provide details for a one-time purchase. Users enter
billing information, including name, billing address, and contact details. Users choose
their preferred payment method (credit/debit card, digital wallets, etc.).Transparency
in the order summary helps users verify their choices before finalizing the purchase.
● Product Reviews: Product reviews are a form of user-generated content where
customers share their experiences, opinions, and feedback about a particular product.
Users can provide detailed written comments, sharing their experiences, highlighting
pros and cons, and offering specific details about the product. Reviews are typically
displayed on the product pages, making it easy for potential buyers to access firsthand
information from other customers.

18
8.NON FUNCTIONAL REQUIREMENTS

● Performance:The system should be able to handle a large number of concurrent users


and maintain response times within acceptable limits. The database queries and data
retrieval should be optimised for efficiency and speed.The system should be scalable
to accommodate future growth in user base and data volume.
● Security:User authentication and authorization should be implemented to ensure that
only authorised users can access and interact with the system.The system should
protect against common security threats such as SQL injection, cross-site scripting
(XSS), and cross-site request forgery (CSRF).Sensitive user information, such as
passwords, should be stored securely using appropriate encryption methods.
● Usability:The user interface should be intuitive, user-friendly, and responsive across
different devices and screen sizes.The system should provide clear and informative
error messages to guide users in case of incorrect inputs or issues. Accessibility
guidelines should be followed to ensure the system is usable by individuals with
disabilities.
● Reliability:The system should have a high level of availability and uptime,
minimising any potential downtime or service interruptions.Regular backups of the
system and its data should be performed to prevent data loss in case of failures or
disasters. Error handling and logging mechanisms should be in place to capture and
report errors, ensuring system stability.
● Compatibility:The system should be compatible with commonly used web browsers
and devices, ensuring a consistent experience across different platforms. It should
adhere to web standards and guidelines to support interoperability and future
compatibility.
● Maintainability:The codebase should follow coding conventions and best practices,
making it easier for developers to understand and maintain the system.
Documentation should be provided, including a clear architectural overview,
installation instructions, and guidelines for future development and
enhancements.The system should be modular and well-organised, allowing for easier
addition of new features or modifications.
● Performance Testing: Performance testing should be conducted to identify potential
bottlenecks, optimise system performance, and ensure it can handle the expected
load.Load testing should be performed to determine the system's capacity and
scalability under heavy user loads.
● Privacy:The system should comply with relevant data protection and privacy
regulations, ensuring the confidentiality of user information and adhering to privacy
policies.User data should not be shared with third parties without explicit consent.

19
9.SYSTEM DESIGN

INTRODUCTION TO DESIGN
UNIFIED MODELLING LANGUAGE DIAGRAMS

The unified modelling language allows the software engineer to express an analysis model
using the modelling notation that is governed by a set of syntactic semantic and pragmatic
rules.

A UML system is represented using five different views that describe the system from a
distinctly different perspective. Each view is defined by a set of diagrams, which is as
follows.

● User Model View


This view represents the system from the user's perspective.
The analysis representation describes a usage scenario from the end-users perspective.
● Structural Model view
In this model the data and functionality are arrived from inside the system.
This model view models the static structures.
● Behavioral Model View
It represents the dynamic of behaviour as parts of the system, depicting the interactions
of collection between various structural elements described in the user model and
structural model view.
● Implementation Model view
In this the structural and behavioural parts of the system are represented as they are to
be built.
● Environmental model view
In this the structural and behavioural aspects of the environment in which the system is
to be implemented are represented.

UML IS SPECIFICALLY CONSTRUCTED THROUGH TWO


DIFFERENT DOMAINS THEY ARE

UML Analysis modelling, this focuses on the user model and structural model views of the
system.

20
✔ UML design modelling, which focuses on the behavioural modelling, implementation
modelling and environmental model views.
Use case Diagrams represent the functionality of the system from a user‘s point of view.
Use cases are used during requirements elicitation and analysis to represent the
functionality of the system. Use cases focus on the behaviour of the system from an
external point of view. Actors are external entities that interact with the system.
Examples of actors include users like administrators, bank customers … etc.., or another
system like a central database.

BUILDING BLOCKS OF THE UML

The vocabulary of the UML Encompasses three kinds of building blocks.

1. Things

2. Relationship

3. Diagrams

Things are abstractions that are first-class citizens in a model; relationships tie these things
together; diagrams group interesting collections of things.

Things in the UML:

There are four kinds of things in the UML:

1. Structural things

2. Behavioural things

3. Grouping things

4. An notational things

These things are the basic object-oriented building blocks of the UML. You use them to write
well-formed models.

Relationships in the UML:

There are four kinds of relationships in the UML:

1. Dependency

2. Association

3. Generalisation

4. Realisation

21
These relationships are the basic relational building of the UML. You use them to write well-
formed models.

First, a dependency is a semantic relationship between two things in which a change to one
thing (the independent thing) may affect the semantics of the other thing (dependent thing).
Graphically, a dependency is rendered as a dashed line, possibly directed, and occasionally
including a label.Second, an associations a structural relationship that describes a set of links,
a link being a connection amongObjects. Aggregation is a special kind of association,
representing a structural relationship between a whole and its parts. Graphically an
association is rendered as a solid line, possibly directed, occasionally including a label, and
often containing other adornments, such as multiplicity and role names.

Third, a generalisation is a specialisation/generalisation

Relationship in which objects of the specialised element (the child) are substitutable for
objects of the generalised element (the parent). In this way, the child shares the structure and
behaviour of the parent. Graphically, a generalisation relationship is rendered as a solid line
with a hollow arrow head pointing to the parent.

Fourth, a realisation is a Semantic relationship between classifiers , where one classifier


specifies a contract that another classifier guarantees to carry out. You ‗ll encounter
realisation relationships in two places: between interfaces and the classes or components that
realise them, and between use cases and the collaborations that realise them . Graphically, a
realisation relationship is rendered as a cross between a generalisation and a dependency
relationship.

These four elements are the basic relational things you may include in a UML model. There
are also variations on these four, such as refinement, trace, include, and extend (for
dependencies) .

The five views of architecture are discussed in the following section.

Diagrams in the UML:

A diagram is the graphical presentation of a set of elements, most often rendered as a


connected graph of vertices (things) and arcs (relationships). You draw diagrams to visualise
a system from different perspectives, so a diagram is a projection into a system. For all but
the most trivial systems, a diagram represents an elided view of the elements that make up a
system. The same element may appear in all diagrams, only a few diagrams (the most
common case), or in no diagrams at all (a very rare case). In theory a diagram may contain
any combination of things and relationships. In practice, however, a small number of
common combinations arise , which are consistent with the five most useful views that
comprise the architecture of a software intensive system. For this reason , the UML includes
nine such diagrams:

22
1.Class diagram

2. Object diagram

3. Use Case diagram

4. Sequence diagram

5. Collaboration diagram

6. State chart diagram


7. Activity diagram

8. Component diagram

9. Deployment diagram

A class diagram shows a set of classes , interfaces and collaborations and their relationships .
These diagrams are the most common diagrams found in modelling object-oriented systems.
Class diagrams address the static design view of a system. Class diagrams that include active
classes address the static process view of a system.

An object diagram shows a set of objects and their relationships. Object diagrams represent
static snapshots of instances of the things found in class diagrams . These diagrams address
the static design view or static process view of a system as do class diagrams , but from the
perspective of real or prototypical cases.

A use case diagram shows a set of use cases and actors(a special kind of class) and their
relationships. Use Case diagrams address the static use case view of a system. These
diagrams are especially important in organising and modelling the behaviours of a system.
Both sequence diagrams and collaboration diagrams are kinds of interaction diagrams. An
shows an interaction , consisting of a set of objects and their relationships, including the
messages that may be dispatched among them. Interaction diagrams address the dynamic
view of a system.

A sequence diagram is an interaction diagram that emphasises the time-ordering of


messages; a collaboration diagram is an interaction diagram that emphasises the structural
organisation of the objects that send and receive messages . Sequence diagrams and
collaboration diagrams are isomorphic, meaning that you can take one and transform it into
the other.

A state chart diagram shows a state machine , consisting of states, transitions,events and
activities. State chart diagrams address the dynamic view of a system. They are especially
important in modelling the behaviour of an interface , class,or collaboration and emphasise
the event-ordered behaviour of an object , which is especially useful in modelling reactive
systems.

23
An activity diagram is a special kind of a state chart diagram that shows the flow from
activity to activity within a system. Activity diagrams address the dynamic view of a system.
They are especially important in modelling the function of a system and emphasise the flow
of control among objects.

A component diagram shows the organisations and dependencies among a set of


components. Component diagrams address the static implementation view of a system. They
are related to class diagrams in that a component typically maps to one or more classes,
interfaces, or collaborations.
A deployment diagram shows the configuration of run-time processing nodes and the
components that live on them. Deployment diagrams address the static deployment view of
architecture . They are related to component diagrams in that a node typically encloses one or
more components.

This is not a closed list of diagrams. Tools may use the UML to provide other kinds of
diagrams, although these nine are by far the most common you will encounter in practice.

24
10.UML DIAGRAMS

USE CASE DIAGRAM FOR PROPOSED SYSTEM

25
SEQUENCE DIAGRAM

CLASS DIAGRAM

26
DATA FLOW DIAGRAM

27
11.CODING AND IMPLEMENTATION

A Django project typically consists of several components and follows certain requirements
to ensure proper functionality and maintainability. A Django project is a web development
project that utilizes the Django web framework. Django is a high-level Python web
framework that encourages rapid development and clean, pragmatic design. It follows the
Model-View-Controller (MVC) architectural pattern, but in Django, it's often referred to as
the Model-View-Template (MVT) pattern. Here are the main requirements a Django project
should contain:

● Django Installation: Make sure Django is installed on your system. You can install
Django using pip, preferably within a virtual environment.
● Project Structure: A Django project should have a well-defined structure. The root
directory of the project usually contains the project's settings (`settings.py`), URL
configuration (`urls.py`), and other project-specific files.
● Application Structure: A Django project consists of one or more applications. Each
application within the project has its own set of models, views, templates, and static
files. Applications can be created using the `startapp` command.
● Models: Models define the structure and behaviour of the data in your Django project.
They are typically defined in the `models.py` file of each application. Models can
include fields, relationships, and methods to interact with the data.
● Views: Views handle the logic and process incoming requests. They perform tasks
such as retrieving data from the database, processing form submissions, and rendering
templates. Views are typically defined in the `views.py` file of each application.
● Templates: Templates define the structure and presentation of the HTML pages. They
contain HTML along with placeholders for dynamic data. Django uses a template
engine to render the templates with the data provided by the views.
● URL Configuration: URL configuration maps URLs to specific views in your Django
project. The `urls.py` file in the project's root directory and in each application defines
the URL patterns and their corresponding views.
● Static Files: Static files include CSS, JavaScript, images, and other assets required by
your project. Django provides a built-in mechanism to handle static files and serves
them efficiently during development and production.
● Forms: Forms are used to handle user input, such as submitting data or performing
search queries. Django provides form classes that simplify the process of validating
and processing user input.
● User Authentication: Django includes a robust authentication system for user
management. It provides features like user registration, login, logout, password reset,
and user permissions. It is crucial to secure your project by implementing proper user
authentication.
● Database Configuration: Django supports multiple databases, and the database
configuration is specified in the project's `settings.py` file. You can choose from

28
various database backends supported by Django, such as SQLite, MySQL,
PostgreSQL, or Oracle.
● Middleware: Middleware components sit between the web server and the Django
application. They process requests and responses, performing functions like
authentication, request/response modification, and error handling.
● Deployment Configuration: When deploying a Django project to a production
environment, certain configurations need to be adjusted. These include setting up the
web server, configuring the database connection, managing static and media files, and
enabling security measures.
● Testing: Writing tests for your Django project is essential to ensure that the code
behaves as expected and to catch any potential issues. Django provides a testing
framework that allows you to write unit tests, integration tests, and functional tests for
your project.

PROJECT STRUCTURE

1. Project Setup: Create a new Django project using the command: `django-admin
startproject ecommerce` Create a new Django app within the project using the command:
`python manage.py startapp myapp`

2. Database Configuration: Configure the database settings in the `settings.py` file of the
project.

3. Models:
- Define the necessary models in the `models.py` file of the `myapp` app. The models
could include:
- User: Represents the user account information.
- Product: Represents the Product details, including product title, add to cart, review,
contact message, category.

4. User Authentication and Account Verification: Implement user registration and login
functionality, including email verification for account activation.Use Django's built-in
authentication system or third-party libraries like Django-Allauth to handle user
registration, login, and account management.

5. Views:
- Implement views for different functionalities within the `views.py` file of the `myapp`
app.
- Home View: Display a list of Product categories on the homepage.
- Detail View: Allow users to view the detailed description of the product.
- Cart View: Show users the products that were added to cart by them and also allow
users to remove if unnecessary.
29
- Email Verification View: Handle the verification process and activate user accounts.

6. URLs: Configure the URL routing for different views in the `urls.py` file of the
`myapp` app. Map the URLs to their respective views using Django's URL patterns.
7. Templates: Create HTML templates within the `templates` directory of the `myapp`
app to render the different views. Design the templates for home page, cart view, contact
form, email verification, etc.

8. Static Files: Manage static files such as CSS, JavaScript, and images in the `static`
directory of the project.

9. Forms: Create Django forms in the `forms.py` file of the ` myapp` app to handle form
validation and user input.

10. Testing: Write test cases to ensure the proper functioning of the implemented features.
Use Django's testing framework or third-party libraries like for testing.

11. Deployment: Deploy the Django application on a hosting platform or server of your
choice. Configure any necessary settings for production, such as database and static file
serving.

APPLICATION STRUCTURE

1. Models:
- User: Fields - username, email, password, is_verified
- Products: Fields – product title, review, contact form, category, add to cart etc

2. Views:
- Home View: Renders the home page where product categories are visible
- Registration View: Handles user registration and email verification
- Login View: Handles user login
- Product View: Allows users to view products, product title, description, price etc
- Cart View: Allows users to add the products to cart - contact form: Allow users to submit
their message

3. Templates:
- base.html: Base template with header, navigation, and footer that other templates extend
from
- cart.html: Allow users to add products to cart
- categories.html: Allow products to divide category wise.
- Order.html: Allow users to order the products

30
- Contact_us.html: Allow users to submit their problem/message – faq_list.html: User
frequently asked questions

4. URLs:
- /: Maps to the Home View, displays products
- /register/: Maps to the Registration View, handles user registration
- /login/: Maps to the Login View, handles user login
- /logout/: Maps to a logout function, logs out the user
- /cart/: Maps to the Cart_View, allows users to add products to cart
- /contact/: Maps to the Contact form, allows users to submit contact form
- /add_review/: Maps to the review page, allows users to write reviews on specific
products

5. Authentication and Authorization:


- Use Django's built-in authentication system for user registration, login, and logout
- Restrict access to add products to cart, write review, and submit contact form to
authenticated and verified users

6. Additional Features:
- Added search bar option to allow users to search for specific product.
- Implemented user contact form where users can submit their messages/problem with
the application.
- Implemented review page where users can submit their review on products

AUTHENTICATION
Admin.py

from django.contrib import admin


from myapp.models import Product,Cart,Buy,Wishlist,Reply,Category,FAQ,ContactMessage
# Register your models here.
admin.site.register(Product)

admin.site.register(Cart)

admin.site.register(Buy)

admin.site.register(Wishlist)
admin.site.register(Reply)
admin.site.register(Category)

31
#admin.site.register(ProductReply)
admin.site.register(FAQ)
admin.site.register(ContactMessage)
Apps.py

from django.apps import AppConfig

class MyappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'myapp'
Models.py

from django.db import models


from django.contrib.auth.models import User

class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
bio = models.TextField(max_length=500, blank=True)

class Category(models.Model):
title=models.CharField(max_length=50)
img=models.ImageField(upload_to='')
slug=models.SlugField()
def __str__(self):
return self.title

class Product(models.Model):
title = models.CharField(max_length=100)
description = models.TextField()
slug = models.SlugField()
price = models.DecimalField(max_digits=10, decimal_places=2)
img = models.ImageField(upload_to='')
in_stock = models.BooleanField(default=True)
category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True,
blank=True)

def __str__(self):
return self.title

class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
bio = models.TextField(max_length=500, blank=True)

class Cart(models.Model):
cart_id=models.CharField(max_length=100)

32
price=models.DecimalField(max_digits=10,decimal_places=2)
quantity=models.IntegerField()
timestamp=models.DateTimeField(auto_now=True)
product=models.ForeignKey(Product,on_delete=models.PROTECT)

def _str_(self):
return self.product.title
def update_quantity(self,quantity):
self.quantity+=quantity
self.save()
def total(self):
return self.quantity*self.price
class Buy(models.Model):
product=models.ForeignKey(Product,on_delete=models.PROTECT)
quantity=models.IntegerField()
price=models.DecimalField(max_digits=10,decimal_places=2)

def _str_(self):
return self.product.title+'_'+str(self.id)

class Reply(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
content = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
product = models.ForeignKey(Product, on_delete=models.CASCADE,
related_name='replies')

def __str__(self):
return f"Reply by {self.user.username} on {self.product.title}

class ContactMessage(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField()
subject = models.CharField(max_length=200)
message = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)

def __str__(self):
return f"Message from {self.name} - {self.subject}"
class FAQ(models.Model):
question = models.CharField(max_length=255)
answer = models.TextField()
URLs.py

from django.contrib import admin

33
from django.urls import path,include
from myapp.views import send_email, order, products, detail, cart_view, category,
return_view, add_reply, cancel_view, add_review, contact_us, contact_us_success, faq_list
app_name='myapp'

urlpatterns = [
path('products/<int:product_id>/<slug:slug>',products,name='products'),
path('',category,name='category'),
path('<int:product_id>/<slug:slug>',detail,name='detail'),
path('cart/',cart_view,name='cart_view'),
path('order/',order,name='order'),
path('success/',return_view,name='return_view'),
path('cancel/',cancel_view,name='cancel_view'),
path('sendmail/',send_email,name="send_email"),
# Assuming 'add_reply' is the URL endpoint for adding replies
path('product/<int:product_id>/add_review/', add_review, name='add_review'),
#path('otp/<str:otp>/<str:password>/<str:email>/',otp,name='otp'),
path('contact/', contact_us, name='contact_us'), # Define the URL pattern for contact_us
path('contact/success/', contact_us_success, name='contact_us_success'), # Success page
after submitting contact form
path('faqs/', faq_list, name='faq_list'),
]
Views.py

from django.shortcuts import render,redirect


from django.http import HttpResponse
from myapp.models import Product, Cart, Buy, Reply, Category, FAQ
from myapp.forms import CartForm
from django.urls import reverse
from django.shortcuts import render
from paypal.standard.forms import PayPalPaymentsForm
from django.contrib.auth.decorators import login_required
# Create your views here.
from myapp.myapp import *
from django.shortcuts import render

from django.shortcuts import redirect, get_object_or_404

def products(request,product_id,slug):
p=Product.objects.filter(category=product_id)
if request.GET.get('q'):
query=request.GET.get('q')

34
p=Product.objects.filter(title__contains=query)
context={'p':p}
return render(request,'index.html',context)
def detail(request,product_id,slug):
d=Product.objects.get(id=product_id)
reviews = Reply.objects.filter(product=d)
if request.method=="POST":
f=CartForm(request,request.POST)
if f.is_valid():
request.form_data=f.cleaned_data
add_to_cart(request)
#return HttpResponse('added to cart')
return redirect('myapp:cart_view')
f=CartForm(request,initial={'product_id':product_id})
context={'d':d,'f':f,'reviews': reviews}
return render(request,'detail.html',context)
def cart_view(request):
if request.method == "POST" and 'delete' in request.POST:
item_id = request.POST.get('item_id')
print(f"Received item_id: {item_id}") # Add this line for debugging

if item_id: # Check if item_id is not empty before querying the database


try:
cd = Cart.objects.get(id=int(item_id))
cd.delete()
except Cart.DoesNotExist:
print("Cart item does not exist") # Add this line for debugging

c = get_cart(request)
t = total(request)
co = item_count(request)
context = {'c': c, 't': t}
return render(request, 'cart.html', context)

def order(request):
# What you want the button to do.
items=get_cart(request)
for i in items:
b=Buy(product_id=i.product_id,quantity=i.quantity,price=i.price)
b.save()
paypal_dict = {
"business": "sb-l7r2e28145955@business.example.com",
"amount": total(request),
"item_name":cart_id(request),
"invoice": str(uuid.uuid4()),

35
"notify_url": request.build_absolute_uri(reverse('paypal-ipn')),
"return": request.build_absolute_uri(reverse('myapp:return_view')),
"cancel_return": request.build_absolute_uri(reverse('myapp:cancel_view')),
"custom": "premium_plan", # Custom command to correlate to some function later
(optional)
}

# Create the instance.


form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form,"items":items,"total":total(request)}
return render(request, "order.html", context)
def return_view(request):
return HttpResponse('Transaction Succesful')
def cancel_view(request):
return HTTpResponse('Trransaction Canclled')

from django.core.mail import BadHeaderError, send_mail


from django.http import HttpResponse, HttpResponseRedirect

def send_email(request):
subject = request.POST.get("subject", "Hi Geld Bro")
message = request.POST.get("message", "otp is 465625")
from_email = request.POST.get("from_email", "chaitanya4656@gmail.com")
if subject and message and from_email:
try:
send_mail(subject, message, from_email, ["admin@example.com"])
except BadHeaderError:
return HttpResponse("Invalid header found.")
return HttpResponseRedirect("Mail sent to geld")
else:
# In reality we'd use a form class
# to get proper validation errors.
return HttpResponse("Make sure all fields are entered and valid.")
def add_reply(request, product_id):
if request.method == "POST" and request.user.is_authenticated:
reply_text = request.POST.get('reply_text')
product = get_object_or_404(Product, id=product_id)

if reply_text:
ProductReply.objects.create(product=product, user=request.user,
reply_text=reply_text)
# Redirect back to the product detail page after adding the reply
return redirect('myapp:detail', product_id=product_id, slug=product.slug)

36
# Redirect to a specific page if there's an issue with adding the reply
return redirect('myapp:some_error_page')

#==============================================and reviews code

def add_review(request, product_id):


product = get_object_or_404(Product, id=product_id)
if request.method == 'POST':
review_content = request.POST.get('review_content')
if review_content:
user = request.user
review = Reply.objects.create(user=user, content=review_content, product=product)
# Perform any other actions you need after adding a review
# Redirect to the product detail view after adding the review
review.save()
return redirect('myapp:detail', product_id=product.id, slug=product.slug)

# If there's an issue adding the review, redirect to a specific page


return HttpResponseRedirect(reverse('myapp:index'))

# If there's an issue adding the review, redirect to a specific page


return HttpResponseRedirect(reverse('myapp:index'))

#=============================== contact us
from .models import ContactMessage
from .forms import ContactForm

def contact_us(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
form.save()
return redirect('myapp:contact_us_success') # Redirect to a success page after form
submission
else:
form = ContactForm()
return render(request, 'contact_us.html', {'form': form})

def contact_us_success(request):
return render(request, 'contact_us_sucess.html')

def category(request):
c= Category.objects.all()
context={'c':c}

37
print(c)
return render(request,'categories.html',context)
def faq_list(request):
faqs = FAQ.objects.all()
return render(request, 'faq_list.html', {'faqs': faqs})

ECOMMERCE
Asgi.py

import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecommerce.settings')
application = get_asgi_application()

Settings.py

"""
Django settings for ecommerce project.
Generated by 'django-admin startproject' using Django 4.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.


BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production


# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!


SECRET_KEY = 'django-insecure--
hv1l#^m$8s*0fkxb&(x4)wjx1+xu+c3)k9kzzbneh%5pbi(^7'

# SECURITY WARNING: don't run with debug turned on in production!


DEBUG = True

ALLOWED_HOSTS = ['*']

# Application definition

38
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
'paypal.standard.ipn',
'registration',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'ecommerce.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'ecommerce.wsgi.application'

# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

39
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}

# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/

# Internationalization
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'US/Pacific'
USE_I18N = True
USE_L10N = True
USE_TZ = True

# Static files (CSS, JavaScript, Images)


# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = 'static'

# Default primary key field type


# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
LOGIN_REDIRECT_URL='/'

40
REGISTRATION_OPEN=True
ACCOUNT_AUTHENTICATED_REGISTRATION_REDIRECTS=False
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_URL = '/media/'
# Older versions of Django that use os module for path traversal do this instead
MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\','/')
PAYPAL_TEST = True
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'chaitanya4656@gmail.com'
EMAIL_HOST_PASSWORD = 'ikye yiej rpzu rnld'
EMAIL_USE_TLS = True
REGISTRATION_EMAIL_SUBJECT_PREFIX = '[Ecommerce]'
URLs.py

from django.contrib import admin


from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('myapp.urls')),
path('paypal/', include("paypal.standard.ipn.urls")),
path('accounts/',include('registration.backends.default.urls')),
]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)

TEMPLATES

Base.html

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ECOMMERCE BLOG</title>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"

41
integrity="sha384-
xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N"
crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-
DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct"
crossorigin="anonymous"></script>
</head>
<style>
body{
background-image:url(https://images.pexels.com/photos/255379/pexels-photo-
255379.jpeg?cs=srgb&dl=pexels-miguel-%C3%A1-padri%C3%B1%C3%A1n-
255379.jpg&fm=jpg&_gl=1*1ibnqst*_ga*MTIxNjc1NzY3Mi4xNjk5NTA5MjIy*_ga_8JE6
5Q40S6*MTcwMDQ1MjYyNS40LjAuMTcwMDQ1MjYyNS4wLjAuMA..);
background-size: cover;
}
</style>
<body>
<!-- Navbar Section -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">
<img src="https://encrypted-
tbn0.gstatic.com/images?q=tbn:ANd9GcRAITlFkQViT6IOEEUqwvb36yEs4G-
sJnp7Uw&usqp=CAU"
width="30" height="30" class="d-inline-block align-top" alt="">
Ecommerce
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle
navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{% url 'myapp:category' %}">Home <span
class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'myapp:faq_list' %}">FAQ</a>

42
</li>

<li class="nav-item active">


<a class="nav-link" href="{% url 'myapp:contact_us' %}">Contact us</a>
</li>

</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" name="q"
value="{{request.GET.q}}"
placeholder="Search" aria-label="Search">

</form>
{% if not user.is_authenticated %}
<a class="btn btn-primary" href="{% url 'auth_login' %}">Login</a>&nbsp;
<a class="btn btn-primary" href="{% url 'registration_register' %}">Register</a>
{% else %}
<li class="nav-item active">
<a class="nav-link" class="btn btn-primary" href="{% url 'myapp:cart_view' %}"
>Cart</a>
</li>
<a class="btn btn-primary" href="{% url 'auth_logout' %}">Logout</a>

{% endif %}
</div>
</nav>

<!-- Main Content Area -->


<div class="row">
<!-- Main Content Section -->
<div class="col-md-12" style="background-color: #f0f0f0;"> <!-- Set your desired
background color -->
<!-- Main content area (products, featured items, etc.) -->
<marquee><h1 style="text-align: center;">Welcome to our Ecommerce
Store!</h1></marquee>
<!-- Products display, featured items, etc. -->
{% block content %}
<!-- Your specific content for each page -->
{% endblock %}
</div>
</div>

<!-- Footer Section -->

43
<footer class="bg-dark text-light py-3">
<div class="container text-center">
<p>&copy; 2023 Ecommerce Store. All Rights Reserved.</p>
</div>
</footer>
</body>

</html>
Cart.html

{% extends 'base.html' %}
{% block content %}
<table class="table table-striped table-dark">
<thead>
<tr>
<th scope="col">S.NO</th>
<th scope="col">Product</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Total Cost</th>
</tr>
</thead>
<tbody>
{% for item in c %}
<tr>
<th scope="row">{{ forloop.counter }}</th>
<td>{{ item.product.title }}</td>
<td>{{ item.price }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.total }}</td>
<td>
<form action="" method="POST">
{% csrf_token %}
<input type="hidden" name="item_id" value="{{ item.id }}"> <!-- Change i.id
to item.id -->
<input class="btn btn-danger" type="submit" name="delete" value="Delete">
</form>

</td>
</tr>
{% endfor %}
</tbody>
</table>
<br>

44
<h4 class="btn-danger">Total : Rs {{ t }}<br></h4>
<br>
<a class="btn btn-secondary" href="{% url 'myapp:order' %}">Order</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn btn-secondary" href="{% url 'myapp:category' %}">Back/Continue</a>
{% endblock %}
Categories.html

{% extends 'base.html' %}

{% block content %}
<h3>Products By Category</h3>
<div class="row">
{% for i in c %}
<div class="col-md-3">
<div class="card">
<a href="{% url 'myapp:products' i.id i.slug %}">
<img src="{{i.img.url}}" class="card-img-top" alt="{{i.title}}" width="100px"
height="200px">
</a>
<div class="card-body">
<h5 class="card-title"><a href="{% url 'myapp:products' i.id i.slug
%}">{{i.title}}</a></h5>
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
Contact_us.html

{% extends 'base.html' %}
{% block content %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
{% endblock %}
Contact_us_sucess.html

{% extends 'base.html' %}
{% block content %}
<h2>Thank you for your message!</h2>
<p>We will get back to you soon.</p>

45
{% endblock %}
Detail.html

{% extends 'base.html' %}

{% block content %}
<div class="container mt-5">
<div class="row">
<div class="col-md-6">
<h2>{{ d.title }}</h2>
<p>{{ d.description }}</p>
<p>Price: ₹{{ d.price }}</p>
</div>
<div class="col-md-6">
<img src="{{ d.img.url }}" width="400" height="500" alt="{{ d.title }}">
</div>
</div>

{% if d.in_stock and user.is_authenticated %}


<div class="mt-4">
<form action="{% url 'myapp:detail' d.id d.slug %}" method="post">
{% csrf_token %}
{{ f }}
<button type="submit" class="btn btn-primary">Add to Cart</button>
</form>
</div>
{% elif not user.is_authenticated %}
<div class="mt-4">
<p>Please <a href="{% url 'auth_login' %}">login</a> to add this item to the
cart.</p>
</div>
{% else %}
<div class="mt-4">
<p>This product is currently out of stock.</p>
</div>
{% endif %}

{% if user.is_authenticated %}
<div class="mt-4">
<form method="post" action="{% url 'myapp:add_review' d.id %}">
{% csrf_token %}
<div class="form-group">
<label for="review_content">Add a Review</label>

46
<textarea class="form-control" id="review_content" name="review_content"
rows="4" placeholder="Write your review here"></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit Review</button>
</form>
</div>
{% else %}
<div class="mt-4">
<p>Please <a href="{% url 'auth_login' %}">login</a> to add a review or rating.</p>
</div>
{% endif %}

<hr>

{% if reviews %}
<div class="mt-4">
<h2>Reviews</h2>
<ul class="list-group">
{% for review in reviews %}
<li class="list-group-item">
<p>{{ review.content }}</p>
<small class="text-muted">Date: {{ review.timestamp|date:"F d, Y" }}</small>
</li>
{% endfor %}
</ul>
</div>
{% else %}

{% endif %}

<div class="mt-3">

</div>
</div>
{% endblock %}
Faq_list.html

<!-- myapp/templates/myapp/faq_list.html -->


<!DOCTYPE html>
<html>
<head>
<title>FAQ List</title>
</head>
<body>
<h1>Frequently Asked Questions</h1>

47
<ul>
{% for faq in faqs %}
<li>
<strong>{{ faq.question }}</strong><br>
{{ faq.answer }}
</li>
{% endfor %}
</ul>
</body>
</html>
Index.html

{% extends 'base.html' %}

{% block content %}
<div class="container-fluid" style="background-color: #f0f0f0;">

<div class="container">
<div class="row row-cols-1 row-cols-md-4 g-4">
{% for i in p %}
<div class="col">
<div class="card h-100">
<img src="{{ i.img.url }}" class="card-img-top img-fluid" style="height:
300px; object-fit: cover;" alt="{{ i.title }}">
<div class="card-body">
<a href="{% url 'myapp:detail' i.id i.slug %}">
<h5 class="card-title"><b>{{ i.title }}</b></h5>
</a>
<p class="card-text">₹{{ i.price }}</p>
<a href="{% url 'myapp:detail' i.id i.slug %}" class="btn btn-primary">View
Product</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}
Order.html

{% extends 'base.html' %}
{% block content %}

48
<body style="background-image:
url(https://static.vecteezy.com/system/resources/previews/000/684/243/original/online-
payment.jpg)">
<centre>
<div class="col-sm-6">
<div class="card">

<div class="card-body">
<br>Cart :</br><br>

<h5>Products :</h5>
{% for i in items %}
{{i.product}}<br>
{% endfor %}
<h5>Total Amount to pay :</h5>{{total}}
<h1>Show me the money!</h1>
<!-- writes out the form tag automatically -->
{{ form.render }}</centre>
</div>
</div>
</div>
</body>
{% endblock %}
Otp.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method="POST" action="{% url 'app:otp' otp=otp username=username
password=password email=email %}">
{% csrf_token %}
<h1>Enter OTP:</h1>
<input type="text">
<button>submit</button>
</form>
</body>
</html>

49
Manage.py

#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecommerce.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)

if __name__ == '__main__':
main()

50
11.SOFTWARE TESTING

TYPES OF TESTING

 Unit testing
 Module testing
 Integration testing
 Validation testing ✔Output testing

Unit Testing

● In this online examination system unit testing check login form. Unit testing
focuses verification efforts on the smallest unit of the software design, the
module.
● Unit testing focuses verification efforts on the smallest unit of the software
design, the module. This is also known as ―Module Testing‖.
● The modules are tested separately.
● This testing was carried out during the programming stage itself. In this
testing each module is found to be working satisfactory as regards to the
expected output from the module.

Module Testing

This is also known as unit testing. Unit testing focuses on the verification of the smallest unit
of software design of the module. In this each module was found to be working satisfactory
as per the expected output of the module.

Integration Testing

● In this integration testing the modules are checked one by one up to the end module.
Data can be grossed across an interface; one module can have adverse efforts on
another.
● Integration testing is to take unit testing for construction of the program structure
while at the same time conducting tests to uncover errors associated with the
interface.
● The object is to take unit tested modules and build a program structure. All the
modules are combined and tested as a whole.
● Here correction is difficult because the isolation of cause is complicated by the vast
expense of the entire program.

51
● Thus in the integration testing stop, all the errors uncovered are corrected for the text
testing steps.
Validation Testing.

● At the conclusion of integration testing software is completely assembled as a


package, interfacing errors have been uncovered and corrected and a final
series of software tests begins, validation test begins.
● Validation tests can be defined in many ways. But the simple definition is that
validation succeeds when the software functions in a manner that can be
reasonably expected by the examiners.
● After the validation test has been conducted one of two possible conditions
exists.
● One is the function or performance characteristics that conform to
specifications and are accepted and the other is deviation from specification is
uncovered and a deficiency list is created.
● Proposed system under consideration has been tested by using validation
testing and found to be working satisfactorily.

Output Testing

● In output testing each test has a different purpose: all the work should verify that all
the system elements have been properly integrated and perform allocated functions.
No system could be useful if it does not produce the required output.
● Here, output testing is done by checking whether the data being updated through the
database is coming in the correct portion and position of the website template.

TEST CASES

Test User Registration:


● Enter valid email and password.
● Verify that a verification email is sent to the entered email.
● Click on the verification link and verify that the account is successfully created.
● Try registering with an already registered email and verify that the appropriate error
message is displayed.

Test User Login:


● Enter valid email and password.
● Verify that the user is successfully logged in.
● Try logging in with an invalid email or password and verify that the appropriate error
message is displayed.

52
Test Password Reset:
● Request for password reset with a registered email
● Password reset email is sent, and the user can reset their password.
Test Adding a Product:
● Product details (name, description, price, quantity)
● Product is added to the inventory successfully.
Test Editing a Product:
● Modified product details
● Product information is updated in the inventory.
Test Product Availability:
● Check the availability of a product
● Correct availability status (in stock/out of stock) is displayed.
Test Adding Items to Cart:
● Add products to the shopping cart
● Cart is updated with the selected items.
Test Removing Items from Cart:
● Remove items from the shopping cart
● Cart is updated, and the removed items are no longer in the cart.
Test Category Navigation:
● Click on a product category
● Products belonging to the selected category are displayed.
Test Mobile Responsiveness:
 Access the eCommerce site from various devices (desktop, tablet, mobile)
 The site should be responsive and display correctly on different screen sizes.
Test Cart Total Calculation:
 Various items in the shopping cart
 Cart total is calculated correctly based on the selected items and quantities.
Test Product Search:
 Search for products using keywords
 Relevant products are displayed in the search results.
Test Security of Payment Process:
 Attempt to manipulate payment data during checkout
 The system should prevent unauthorized access or manipulation of payment data.

53
12.OUTPUT SCREENS

HOMEPAGE : This is the home page of Ecommerce Web Application project which contains
a navbar with Application name, logo, Home, Faq section and contact form on the left corner.
The right corner of the home page contains search bar, login and register buttons. You can see
some of the categories of the products below the navbar section with their respective titles.

54
REGISTRATION PAGE : This is the registration page of Ecommerce Application. In this
page, users who do not have an account can create here with username, email address,
password and should repeat their password again with the characters provided above. By that,
user completes their registration.

55
LOGIN PAGE : The above mentioned page is a login page. In this page, user can login into
their respective account by using their username and password. Thereafter , the user can
login by clicking on login button. If the user have not registered yet, then they can register by
clicking on the last line ― Not a member? Register‖.

56
HOMEPAGE : This is the homepage of ecommerce web application after a user logged in.
You can see a logout button and cart button on the right corner of the navbar. Now the user
got the access to add products to cart, order products and submit review of a product.

57
Thiswill be the appearance of the products page after opening a category from homepage
(for eg: electronic devices). Here you can see some of the products related to a particular
category. This page contains the products with their images, titles and their respective
prices. There will be button called view product which will take you to the product catalog.
In this page, you can also search the product by its respective title in the search bar.

58
PRODUCT CATALOG PAGE : This is the product catalog page which contains product title,
image, description of the product and its price. Here you can also set the quantity of the
product and add them to cart by clicking on add to cart button. You can see a review box
below the cart button, there you can write your review about the product and submit it by
clicking on submit review button.

59
SHOPPING CART PAGE : This is the cart page in which you can see the products that were
added to cart by user. Here you can see number of products were added, product title, product
price, quantity of the product, total cost in the above tabular form. You can also remove the
products if they are unnecessary by clicking on delete button. Thereafter, you can order the
products by clicking on order button.

60
After clicking on order in previous page, you can see this order page. Here you can observe
the list of products that were ordered by user and also the complete amount needed to pay.
Thereafter, you can complete your payment transaction by clicking on buy now button.

61
This is the payment page through paypal. Once you click on buy now in previous page, you
should enter your paypal credentials and your card details. Therefater, that will lead you to
your successful payment transaction through paypal.

This is the admin login page. It contains the username and password of admin. After the login
process, Admins will get the access to complete all the actions to be done in the project.

This is the admin‘s page which contains authentication and authorization of users and groups.
Buy - all the products ordered by users, Cart - all the products that were added to cart by
users, Categories - all the categories in the application, Contact message - all the contact
forms submitted by users, faq – all the faq‘s in application, reply – all the reviews submitted
by users, products – all the products in application.

62
13.FUTURE SCOPE

The future scope of an eCommerce web application built using Django remains promising,
given the continuous growth of the eCommerce industry and the versatility of the Django
framework. Here are some aspects that highlight the future potential:

Mobile Commerce (mCommerce): The use of smartphones for online shopping continues to
rise. Ensure that your eCommerce application is mobile-friendly and optimized for a
seamless shopping experience on various devices.

Voice Commerce: With the increasing adoption of voice-activated devices, integrating voice
commerce features into your application can cater to users who prefer voice search and
commands for shopping.

Social Commerce: Leverage social media platforms for eCommerce by integrating social
commerce features. This includes the ability to directly sell products on social media
channels and utilize user-generated content for marketing.

Ephemeral Content and Influencer Marketing: Utilize ephemeral content on platforms like
Instagram and Snapchat for time-sensitive promotions. Collaborate with influencers to
promote products and engage with a broader audience.

Cross-Border eCommerce: Facilitate international transactions by providing multiple


currency options, language support, and seamless shipping solutions. The globalization of
eCommerce presents opportunities for expanding your customer base.

Green and Sustainable Practices: As environmental consciousness grows, consider


incorporating green and sustainable practices within your eCommerce operations. This could
include eco-friendly packaging options, carbon footprint tracking, or partnerships with
environmentally responsible suppliers.

Chatbots and Customer Support Automation: Implement chatbots to provide instant customer
support, answer queries, and guide users through the purchasing process. Automation in
customer support can enhance efficiency and improve user satisfaction.

Continuously monitor industry trends, technological advancements, and customer preferences


to adapt your eCommerce web application project to evolving market demands. Regular
updates, user feedback, and innovation will be key to staying competitive in the dynamic
eCommerce landscape.

63
14.CONCLUSION

The Ecommerce Web application project focused on creating a user-friendly platform for
online shopping. It included essential features like user authentication, allowing users to
create accounts and login securely. The shopping cart feature enabled users to add products to
their cart and proceed to checkout.

To enhance the user experience, the project incorporated a review system where customers
could leave feedback and ratings for products. Additionally, a frequently asked questions
section was implemented to address common queries and provide quick solutions.
To facilitate communication, a contact form was included to allow users to reach out to the
site administrators easily.

Overall, the Ecommerce Web application successfully achieved its goal of creating a
seamless online shopping experience with user authentication, a shopping cart, product
reviews, FAQs, and a contact form.

In essence, an eCommerce project's journey is ongoing—a dynamic interplay between


technology, user expectations, and market trends. By embracing innovation, prioritizing user
experience, and maintaining a commitment to security and adaptability, the eCommerce
project can navigate the ever-changing landscape and thrive in the digital marketplace of
tomorrow.

64
15.BIBLIOGRAPHY

DEPLOYMENT LINKS

 https://github.com/SravyaBhamidipalli/finalecom

 https://horsesravyabhamidipalli12.pythonanywhere.com

BOOK REFERENCES

 https://www.google.co.in/books/edition/Python_Web_Development_with_Django/M

2D5nnYlmZoC?hl=en&gbpv=0

65

You might also like