Online Shopping Application Using Django Application (Python)[1]
Online Shopping Application Using Django Application (Python)[1]
ABSTRACT
This project helps the users in curing its disease by giving the list of fruits and
herbs that the user should consume in order to get rid of its disease. The main
purpose of this project is to help the user to easily search for herbs and fruits that will
be good for the health of the user depending on any health issue or disease that
he/she is suffering from.
This system helps the user to reduce its searching time to a great extent by
allowing the user to enter its health problem and search accordingly. The admin can
add fruits and herbs to the system and its information.
This system also allows the user to view the selected fruit or the herb’s
description which describes how the fruit or the herb will help to improve the user’s
health. This system also allows the user to place order which will add the items to the
user’s cart and make payment for the same. The system also includes a module in
which the user can search for the hospitals depending on the name of the disease that
user enters. Thus, this system helps to to get food products best suited for user health
to a great extent. System can recommended some product to the user.
CHAPTER-I
INTRODUCTION
1.INTRODUCTION:
The Shopping cart is mainly useful for who haven’t time to go to shopping, those are just entered
into this website and bought whatever they want. Even it is night or morning they entered into this
site, and chosen different items like health care medical product and food products.
‘Customer is our god’ mainly this website is based on this formula. After chosen items he bought
into Pay pal process like VISA or MASTER credit cards or any Debit cards are accepted in this
website. Customer is happily shopping at his rest place.
computer plays an important role in our daily life. Anything we want we can get only in one mouse
click. Speed, reliability and accuracy of the computer make it a powerful tool for different
purposes. A very important and basic need of today’s modern business world is the quick
availability and processing of information using computer. One can easily get the type of required
information within a fraction of a second. The project that I have taken is also in this category
which is used in our daily life whenever we want to purchase some items we can easily get them at
our home.
Once customer entered with his own username and password, at that time automatically one
shopping cart will be created, once user select an item it will add to cart. In case user thinks the
selected item is not useful for me, then deleted that item from shopping cart.
Customer selected some items, but in his credit or debit cart haven’t that much balance, then
he was logout from the website, the selected items are stored at cart with specific users with his
allotted carts, after some days he bought those items then automatically deleted from the cart.
Admin
Login
View Vendor
Approve Vendor Login
View registered user
Delete Abuse Feedback
Category for used product
User
Register
Login
Manage Wallet Balance
Search Product– Locality, Category, Product items name
View Product details
Add to Cart
Add/Update shipping address
Place Order
View Order Status
Give Feedback
Store Vendor
Login
Register
Add Product
Manage Product
Manage Orders
Update Order Status
CHAPTER-II
SYSTEM STUDY
6
2.1 EXISTINGSYSTEM
Existing Shopping System is the more complicated shopping System. It’s a full-featured onsite
and shopping cart system that bends over backwards to give you the flexibility you need to run
your online store.
The customer who went shopping must know the details of the product that he/she
want to buy. Otherwise, it will be difficult to identify the product, as there are various similar
looking products available. The shop will be out of reach from the distant customers and hence
loose the customers.
2.1.1 DISADVANTAGES
Lack of privacy
Risk in the management of the data.
Less Security
Low co-ordination between
Less User-friendly
Accuracy not guaranteed
Not in reach of distant users.
7
2.2 PROPOSEDSYSTEM
Secure registration and profile management facilities for Customers. Browsing through the e-
Mall to see the items that are there in each category of products like Apparel, Kitchen accessories,
Bath accessories, Food items etc. Creating a Shopping cart so that customer can Shop all number of
items and checkout finally with the entire shopping cart. As the Online Shopping System is web
based so the distant user from the shop can also get the item and the vendor can cover the wide
place to sell. A user can choose from the different products, can make online payments and will get
the products at the doorstep. This will reduce the time consumption in the purchase of different
items, make the system efficient and user-friendly.
2.2.1 ADVANTAGES:
Simple And Easy To Use
Online And Offline Storage Of Data
Automatically Updates And Backups Data.
Flexible And Can Be Fully Configurable
Easily Accessible From Anywhere And Any Time.
Easy Access From Smartphones And Tablets
Reliable And Secure Operations
Review And Tracking Of The Library Functions
Eliminate The Need For Extensive Paperwork
Maintenance Overheads And Operation Costs Are Reduced
Eliminates The Need For Manual Entries
Makes The Database Error-Free And Accurate
8
CHAPTER-III
SYSTEM SPECIFICATION
9
3. SYSTEMSPECIFICATION
3.1 HARDWARESPECIFICATION
Processor : Corei3
RAMCapacity : 1GB
HardDisk : 160 GB
Keyboard : 104Keys
Monitor : 16 inch
MotherBoard :Intel
Speed :2GHZ
3.2 SOFTWARESPECIFICATION
OperatingSystem : Windows10
FrontEnd : HTML,CSS
Backend :SQLite
Language : Python with Django
10
3.3 APPLICATIONSPECIFICATION
HTML
HTML was first created by Tim Berners-Lee, Robert Caillou, and others starting in 1989.
ItstandsforHyperTextMarkupLanguage.Hypertextmeansthatthedocumentcontains linksthat allow
the reader to jump to other places in the document or to another document altogether. The latest
version is known as HTML5. A Markup Language is a way that computers speak to each other to
control how text is processed and presented. To do this HTML uses two things: tags
andattributes.
HTML can embed programs written in a scripting language such as JavaScript, which
affects the behavior and content of web pages. Inclusion of CSS defines the look and layout of
content. The World Wide Web Consortium (W3C), former maintainer of the HTML and current
maintainer of the CSS standards, has encouraged the use of CSS over explicit presentational
HTML.
BENEFITS
o Web pages development. HTML is heavily used for creating pages thatare
displayed on the world wideweb.
o Internet navigation.
o Cutting edgefeature.
o Client-sidestorage.
o Offline capabilitiesusage.
11
o Data Entry support with HTML.
CSS
Cascading Style Sheets (CSS) is a style sheet language used for describing
the presentation of a document written in a markup language like HTML. CSS is a cornerstone
technology of the World Wide Web, alongside HTML andJavaScript.
CSS Selectors
12
PYTHON
Python supports multiple programming paradigms, including Procedural, Object Oriented and
Functional programming language. Python design philosophy emphasizes code readability with the
use of significant indentation.
This tutorial gives a complete understanding of Python programming language starting from basic
conceopts to advanced concepts. This tutorial will take you through simple and practical
approaches while learning Python Programming language.
Pythonwasdesignedforreadability,andhassomesimilaritiestotheEnglishlanguagewith
influence frommathematics.
Python uses new lines to complete a command, as opposed to other programming
languages which often use semicolons orparentheses.
Pythonreliesonindentation,usingwhitespace,todefinescope;suchasthescopeofloops,
functions and classes. Other programming languages often use curly-brackets for this
purpose.
13
Python Online Compiler/Interpreter
We have provided Python Online Compiler/Interpreter which helps you to Edit and Execute the
code directly from your browser. Try to click the icon to run the following Python code to print
conventional "Hello, World!".
Below code box allows you to change the value of the code. Try to change the value
inside print() and run it again to verify the result.
If you know Python nicely, then you have a great career ahead. Here are just a few of the career
options where Python is a key skill:
Game developer
Web designer
Python developer
Full-stack developer
Machine learning engineer
Data scientist
Data analyst
Data engineer
DevOps engineer
Software engineer
Many more other roles
Characteristics of Python
14
It can be used as a scripting language or can be compiled to byte-code for building large
applications.
It provides very high-level dynamic data types and supports dynamic type checking.
It supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Applications of Python
The latest release of Python is 3.x. As mentioned before, Python is one of the most widely used
language over the web. I'm going to list few of them here:
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
Easy-to-maintain − Python's source code is fairly easy-to-maintain.
A broad standard library − Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.
Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.
Databases − Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs than shell
scripting.
15
The Python syntax defines a set of rules that are used to create Python statements while writing a
Python Program. The Python Programming Language Syntax has many similarities to Perl, C, and
Java Programming Languages. However, there are some definite differences between the
languages.
We can invoke a Python interpreter from command line by typing python at the command prompt
as following −
$ python
Python 3.6.8 (default, Sep 10 2021, 09:13:53)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Here >>> denotes a Python Command Prompt where you can type your commands. Let's type the
following text at the Python prompt and press the Enter −
If you are running older version of Python, like Python 2.4.x, then you would need to use print
statement without parenthesis as in print "Hello, World!". However in Python version 3.x, this
produces the following result −
Hello, World!
Python - Script Mode Programming
We can invoke the Python interpreter with a script parameter which begins the execution of the
script and continues until the script is finished. When the script is finished, the interpreter is no
longer active.
Let us write a simple Python program in a script which is simple text file. Python files have
extension .py. Type the following source code in a test.py file −
16
print ("Hello, World!")
We assume that you have Python interpreter path set in PATH variable. Now, let's try to run this
program as follows −
$ python test.py
Hello, World!
Let us try another way to execute a Python script. Here is the modified test.py file −
#!/usr/bin/python
We assume that you have Python interpreter available in /usr/bin directory. Now, try to run this
program as follows −
Hello, World!
Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other object. An
identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
Python does not allow punctuation characters such as @, $, and % within identifiers.
Python is a case sensitive programming language. Thus, Manpower and manpower are two
different identifiers in Python.
Python Class names start with an uppercase letter. All other identifiers start with a lowercase
letter.
17
Starting an identifier with a single leading underscore indicates that the identifier
is private identifier.
Starting an identifier with two leading underscores indicates a strongly private identifier.
If the identifier also ends with two trailing underscores, the identifier is a language-
defined special name.
The following list shows the Python keywords. These are reserved words and you cannot use them
as constant or variable or any other identifier names. All the Python keywords contain lowercase
letters only.
and as assert
global if import
in is lambda
or pass raise
Python programming provides no braces to indicate blocks of code for class and function
definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly
enforced.
18
The number of spaces in the indentation is variable, but all statements within the block must be
indented the same amount. For example −
if True:
print ("True")
else:
print ("False")
if True:
print ("Answer")
print ("True")
else:
print ("Answer")
print ("False")
Thus, in Python all the continuous lines indented with same number of spaces would form a block.
The following example has various statement blocks −
Do not try to understand the logic at this point of time. Just make sure you understood various
blocks even if they are without braces.
import sys
try:
except IOError:
sys.exit()
if file_text == file_finish:
file.close
break
file.write(file_text)
file.write("\n")
file.close()
if len(file_name) == 0:
sys.exit()
try:
except IOError:
sys.exit()
file_text = file.read()
file.close()
print file_text
Statements in Python typically end with a new line. Python does, however, allow the use of the line
continuation character (\) to denote that the line should continue. For example −
20
total = item_one + \
item_two + \
item_three
Statements contained within the [], {}, or () brackets do not need to use the line continuation
character. For example following statement works well in Python −
'Thursday', 'Friday']
Quotations in Python
Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as
the same type of quote starts and ends the string.
The triple quotes are used to span the string across multiple lines. For example, all the following
are legal −
word = 'word'
Comments in Python
Just like most modern languages, Python supports single-line (or end-of-line) and multi-line (block)
comments. Python comments are very much similar to the comments available in PHP, BASH and
Perl Programming languages.
A hash sign (#) that is not inside a string literal begins a comment. All characters after the # and up
to the end of the physical line are part of the comment and the Python interpreter ignores them.
21
# First comment
Hello, World!
You can type a comment on the same line after a statement or expression −
# This is a comment.
Following triple-quoted string is also ignored by Python interpreter and can be used as a multiline
comments:
'''
This is a multiline
comment.
'''
A line containing only whitespace, possibly with a comment, is known as a blank line and Python
totally ignores it.
In an interactive interpreter session, you must enter an empty physical line to terminate a multiline
statement.
The following line of the program displays the prompt, the statement saying “Press the enter key to
exit”, and waits for the user to take action −
#!/usr/bin/python
22
raw_input("\n\nPress the enter key to exit.")
Here, "\n\n" is used to create two new lines before displaying the actual line. Once the user presses
the key, the program ends. This is a nice trick to keep a console window open until the user is done
with an application.
The semicolon ( ; ) allows multiple statements on the single line given that neither statement starts
a new code block. Here is a sample snip using the semicolon −
A group of individual statements, which make a single code block are called suites in Python.
Compound or complex statements, such as if, while, def, and class require a header line and a suite.
Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are
followed by one or more lines which make up the suite. For example −
if expression :
suite
elif expression :
suite
else :
suite
Many programs can be run to provide you with some basic information about how they should be
run. Python enables you to do this with -h −
$ python -h
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-c cmd : program passed in as string (terminates option list)
23
-d : debug output from parser (also PYTHONDEBUG=x)
-E : ignore environment variables (such as PYTHONPATH)
-h : print this help message and exit
[ etc. ]
You can also program your script in such a way that it should accept various options. Command
Line Arguments is an advanced topic and should be studied a bit later once you have gone through
rest of the Python concepts.
Django isaPython-basedfreeandopen-sourcewebframework,whichfollowsthemodel-
template-view (MTV) architecturalpattern.
Django is a high-level Python Web framework that encourages rapid development and clean,
pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web
development,soyoucanfocusonwritingyourappwithoutneedingtoreinventthewheel.It‟sfree and
opensource.
Django provides an abstraction layer (the “models”) for structuring and manipulating the data of
your Web application. Learn more about it below:
24
BACKEND: SQLite
SQLite
SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not
have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete
SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.
The database file format is cross-platform - you can freely copy a database between 32-bit and 64-
bit systems or between big-endian and little-endian architectures. These features make SQLite a
popular choice as an Application File Format. SQLite database files are a recommended storage
format by the US Library of Congress. Think of SQLite not as a replacement for Oracle but as a
replacement for fopen()
SQLite is a compact library. With all features enabled, the library size can be less than 750KiB,
depending on the target platform and compiler optimization settings. (64-bit code is larger. And
some compiler optimizations such as aggressive function inlining and loop unrolling can cause the
object code to be much larger.) There is a tradeoff between memory usage and speed. SQLite
generally runs faster the more memory you give it. Nevertheless, performance is usually quite good
even in low-memory environments. Depending on how it is used, SQLite can be faster than direct
filesystem I/O.
SQLite is very carefully tested prior to every release and has a reputation for being very reliable.
Most of the SQLite source code is devoted purely to testing and verification. An automated test
suite runs millions and millions of test cases involving hundreds of millions of individual SQL
statements and achieves 100% branch test coverage. SQLite responds gracefully to memory
allocation failures and disk I/O errors. Transactions are ACID even if interrupted by system crashes
or power failures. All of this is verified by the automated tests using special test harnesses which
25
simulate system failures. Of course, even with all this testing, there are still bugs. But unlike some
similar projects (especially commercial competitors) SQLite is open and honest about all bugs and
provides bugs lists and minute-by-minute chronologies of code changes.
The SQLite code base is supported by an international team of developers who work on SQLite
full-time. The developers continue to expand the capabilities of SQLite and enhance its reliability
and performance while maintaining backwards compatibility with the published interface
spec, SQL syntax, and database file format. The source code is absolutely free to anybody who
wants it, but professional support is also available.
The SQLite project was started on 2000-05-09. The future is always hard to predict, but the intent
of the developers is to support SQLite through the year 2050. Design decisions are made with that
objective in mind.
We the developers hope that you find SQLite useful and we entreat you to use it well: to make
good and beautiful products that are fast, reliable, and simple to use. Seek forgiveness for yourself
as you forgive others. And just as you have received SQLite for free, so also freely give, paying the
debt forward.
SQLite - Commands
This chapter will take you through simple and useful commands used by SQLite programmers.
These commands are called SQLite dot commands and exception with these commands is that they
should not be terminated by a semi-colon (;).
Let's start with typing a simple sqlite3 command at command prompt which will provide you with
SQLite command prompt where you will issue various SQLite commands.
$sqlite3
SQLite version 3.3.6
Enter ".help" for instructions
sqlite>
For a listing of the available dot commands, you can enter ".help" any time. For example −
sqlite>.help
26
SQLite - Syntax
SQLite is followed by unique set of rules and guidelines called Syntax. This chapter lists all the basic
SQLite Syntax.
Case Sensitivity
The important point to be noted is that SQLite is case insensitive, i.e. the clauses GLOB and glob have
the same meaning in SQLite statements.
Comments
SQLite comments are extra notes, which you can add in your SQLite code to increase its readability and
they can appear anywhere; whitespace can occur, including inside expressions and in the middle of other
SQL statements but they cannot be nested.
SQL comments begin with two consecutive "-" characters (ASCII 0x2d) and extend up to and including
the next newline character (ASCII 0x0a) or until the end of input, whichever comes first.
You can also use C-style comments, which begin with "/*" and extend up to and including the next "*/"
character pair or until the end of input, whichever comes first. C-style comments can span multiple lines.
SQLite Statements
All the SQLite statements start with any of the keywords like SELECT, INSERT, UPDATE, DELETE,
ALTER, DROP, etc., and all the statements end with a semicolon (;).
74
columnN datatype,
PRIMARY KEY( one or more columns )
);
SQLite CREATE TRIGGER Statement
CREATE TRIGGER database_name.trigger_name
BEFORE INSERT ON table_name FOR EACH ROW
BEGIN
stmt1;
stmt2;
....
END;
SQLite CREATE VIEW Statement
CREATE VIEW database_name.view_name AS
SELECT statement....;
SQLite CREATE VIRTUAL TABLE Statement
CREATE VIRTUAL TABLE database_name.table_name USING weblog( access.log );
or
CREATE VIRTUAL TABLE database_name.table_name USING fts3( );
SQLite COMMIT TRANSACTION Statement
COMMIT;
SQLite COUNT Clause
SELECT COUNT(column_name)
FROM table_name
WHERE CONDITION;
SQLite DELETE Statement
DELETE FROM table_name
WHERE {CONDITION};
SQLite DETACH DATABASE Statement
DETACH DATABASE 'Alias-Name';
SQLite DISTINCT Clause
74
SELECT DISTINCT column1, column2....columnN
FROM table_name;
SQLite DROP INDEX Statement
DROP INDEX database_name.index_name;
SQLite DROP TABLE Statement
DROP TABLE database_name.table_name;
SQLite DROP VIEW Statement
DROP INDEX database_name.view_name;
SQLite DROP TRIGGER Statement
DROP INDEX database_name.trigger_name;
SQLite EXISTS Clause
SELECT column1, column2....columnN
FROM table_name
WHERE column_name EXISTS (SELECT * FROM table_name );
SQLite EXPLAIN Statement
EXPLAIN INSERT statement...;
or
EXPLAIN QUERY PLAN SELECT statement...;
SQLite GLOB Clause
SELECT column1, column2....columnN
FROM table_name
WHERE column_name GLOB { PATTERN };
SQLite GROUP BY Clause
SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name;
SQLite HAVING Clause
SELECT SUM(column_name)
74
FROM table_name
WHERE CONDITION
GROUP BY column_name
HAVING (arithematic function condition);
SQLite INSERT INTO Statement
INSERT INTO table_name( column1, column2....columnN)
VALUES ( value1, value2....valueN);
SQLite IN Clause
SELECT column1, column2....columnN
FROM table_name
WHERE column_name IN (val-1, val-2,...val-N);
SQLite Like Clause
SELECT column1, column2....columnN
FROM table_name
WHERE column_name LIKE { PATTERN };
SQLite NOT IN Clause
SELECT column1, column2....columnN
FROM table_name
WHERE column_name NOT IN (val-1, val-2,...val-N);
SQLite ORDER BY Clause
SELECT column1, column2....columnN
FROM table_name
WHERE CONDITION
ORDER BY column_name {ASC|DESC};
SQLite PRAGMA Statement
PRAGMA pragma_name;
For example:
PRAGMA page_size;
74
PRAGMA cache_size = 1024;
PRAGMA table_info(table_name);
SQLite RELEASE SAVEPOINT Statement
RELEASE savepoint_name;
SQLite REINDEX Statement
REINDEX collation_name;
REINDEX database_name.index_name;
REINDEX database_name.table_name;
SQLite ROLLBACK Statement
ROLLBACK;
or
ROLLBACK TO SAVEPOINT savepoint_name;
SQLite SAVEPOINT Statement
SAVEPOINT savepoint_name;
SQLite SELECT Statement
SELECT column1, column2....columnN
FROM table_name;
SQLite UPDATE Statement
UPDATE table_name
SET column1 = value1, column2 = value2....columnN=valueN
[ WHERE CONDITION ];
SQLite VACUUM Statement
VACUUM;
SQLite WHERE Clause
SELECT column1, column2....columnN
FROM table_name
WHERE CONDITION;
Django Introduction
74
Django is a Python framework that makes it easier to create web sites using Python.
Django takes care of the difficult stuff so that you can concentrate on building your web applications.
Django emphasizes reusability of components, also referred to as DRY (Don't Repeat Yourself), and
comes with ready-to-use features like login system, database connection and CRUD operations (Create
Read Update Delete).
Model - The data you want to present, usually data from a database.
View - A request handler that returns the relevant template and content - based on the request from
the user.
Template - A text file (like an HTML file) containing the layout of the web page, with logic on
how to display the data.
74
Model
In Django, the data is delivered as an Object Relational Mapping (ORM), which is a technique designed
to make it easier to work with databases.
The most common way to extract data from a database is SQL. One problem with SQL is that you have to
have a pretty good understanding of the database structure to be able to work with it.
Django, with ORM, makes it easier to communicate with the database, without having to write complex
SQL statements.
View
A view is a function or method that takes http requests as arguments, imports the relevant model(s), and
finds out what data to send to the template, and returns the final result.
Template
A template is a file where you describe how the result should be represented.
Templates are often .html files, with HTML code describing the layout of a web page, but it can also be in
other file formats to present other results, but we will concentrate on .html files.
Django uses standard HTML to describe the layout, but uses Django tags to add logic:
<h1>My Homepage</h1>
74
The templates of an application is located in a folder named templates.
URLs
Django also provides a way to navigate around the different pages in a website.
When a user requests a URL, Django decides which view it will send it to.
When you have installed Django and created your first Django web application, and the browser requests
the URL, this is basically what happens:
1. Django receives the URL, checks the urls.py file, and calls the view that matches the URL.
2. The view, located in views.py, checks for relevant models.
3. The models are imported from the models.py file.
4. The view then sends the data to a specified template in the template folder.
5. The template contains HTML and Django tags, and with the data it returns finished HTML content
back to the browser.
Django can do a lot more than this, but this is basically what you will learn in this tutorial, and are the
basic steps in a simple web application made with Django.
To check if your system has Python installed, run this command in the command prompt:
python --version
If Python is installed, you will get a result with the version number, like this
Python 3.9.2
74
If you find that you do not have Python installed on your computer, then you can download it for free
from the following website: https://www.python.org/
PIP
To install Django, you must use a package manager like PIP, which is included in Python from version
3.4.
To check if your system has PIP installed, run this command in the command prompt:
pip --version
If PIP is installed, you will get a result with the version number.
If you do not have PIP installed, you can download and install it from this
page: https://pypi.org/project/pip/
Virtual Environment
It is suggested to have a dedicated virtual environment for each Django project, and in the next
chapter you will learn how to create a virtual environment, and then install Django in it.
Virtual Environment
It is suggested to have a dedicated virtual environment for each Django project, and one way to manage a
virtual environment is venv, which is included in Python.
The name of the virtual environment is your choice, in this tutorial we will call it myworld.
Type the following in the command prompt, remember to navigate to where you want to create your
project:
Windows:
74
py -m venv myworld
Unix/MacOS:
This will set up a virtual environment, and create a folder named "myworld" with subfolders and files, like
this:
myworld
Include
Lib
Scripts
pyvenv.cfg
Windows:
myworld\Scripts\activate.bat
Unix/MacOS:
source myworld/bin/activate
Once the environment is activated, you will see this result in the command prompt:
Windows:
Unix/MacOS:
(myworld) ... $
74
CHAPTER IV
74
4. SYSTEM DESIGN AND DEVELOPMENT
A data flow diagram is graphical tool used to describe and analyze movement of data through a
system. These are the central tool and the basis from which the other components are developed. The
transformation of data from input to output, through processed, may be described logically and
independently of physical components associated with the system. These are known as the logical data
flow diagrams. The physical data flow diagrams show the actual implements and movement of data
between people, departments and workstations. A full description of a system actually consists of a set of
data flow diagrams. Using two familiar notations Yourdon, Gane and Sarson notation develops the data
flow diagrams. Each component in a DFD is labeled with a descriptive name. Process is further identified
with a number that will be used for identification purpose. The development of DFD’S is done in several
levels. Each process in lower level diagrams can be broken down into a more detailed DFD in the next
level. The lop-level diagram is often called context diagram. It consists a single process bit, which plays
vital role in studying the current system. The process in the context level diagram is exploded into other
process at the first level DFD.
The idea behind the explosion of a process into more process is that understanding at one level of
detail is exploded into greater detail at the next level. This is done until further explosion is necessary and
an adequate amount of detail is described for analyst to understand the process.
Larry Constantine first developed the DFD as a way of expressing system requirements in a
graphical from, this lead to the modular design.
A DFD is also known as a “bubble Chart” has the purpose of clarifying system requirements and
identifying major transformations that will become programs in system design. So it is the starting point
of the design to the lowest level of detail. A DFD consists of a series of bubbles joined by data flows in
the system.
DFD SYMBOLS:
In the DFD, there are four symbols
74
1. A square defines a source(originator) or destination of system data
2. An arrow identifies data flow. It is the pipeline through which the information flows
3. A circle or a bubble represents a process that transforms incoming data flow into outgoing data flows.
4. An open rectangle is a data store, data at rest or a temporary repository of data
Data flow
Data Store
CONSTRUCTING A DFD:
Several rules of thumb are used in drawing DFD’S:
1. Process should be named and numbered for an easy reference. Each name should be representative of
the process.
2. The direction of flow is from top to bottom and from left to right. Data traditionally flow from source
to the destination although they may flow back to the source. One way to indicate this is to draw long
flow line back to a source. An alternative way is to repeat the source symbol as a destination. Since it
is used more than once in the DFD it is marked with a short diagonal.
3. When a process is exploded into lower level details, they are numbered.
4. The names of data stores and destinations are written in capital letters. Process and dataflow names
have the first letter of each work capitalized.
A DFD typically shows the minimum contents of data store. Each data store should contain all the
data elements that flow in and out.
Questionnaires should contain all the data elements that flow in and out. Missing interfaces
redundancies and like is then accounted for often through interviews.
74
SAILENT FEATURES OF DFD’S
1. The DFD shows flow of data, not of control loops and decision are controlled considerations do not
appear on a DFD.
2. The DFD does not indicate the time factor involved in any process whether the dataflow take place
daily, weekly, monthly or yearly.
3. The sequence of events is not brought out on the DFD.
CURRENT PHYSICAL:
In Current Physical DFD process label include the name of people or their positions or the names
of computer systems that might provide some of the overall system-processing label includes an
identification of the technology used to process the data. Similarly data flows and data stores are often
labels with the names of the actual physical media on which data are stored such as file folders, computer
files, business forms or computer tapes.
CURRENT LOGICAL:
The physical aspects at the system are removed as much as possible so that the current system is
reduced to its essence to the data and the processors that transforms them regardless of actual physical
form.
NEW LOGICAL:
This is exactly like a current logical model if the user were completely happy with the user were
completely happy with the functionality of the current system but had problems with how it was
implemented typically through the new logical model will differ from current logical model while having
additional functions, absolute function removal and inefficient flows recognized.
NEW PHYSICAL:
74
The new physical represents only the physical implementation of the new system.
PROCESS
1) No process can have only outputs.
2) No process can have only inputs. If an object has only inputs than it must be a sink.
3) A process has a verb phrase label.
DATA STORE
1) Data cannot move directly from one data store to another data store, a process must move data.
2) Data cannot move directly from an outside source to a data store, a process, which receives, must
move data from the source and place the data into data store
3) A data store has a noun phrase label.
SOURCE OR SINK
The origin and /or destination of data.
1) Data cannot move direly from a source to sink it must be moved by a process
2) A source and /or sink has a noun phrase land
DATA FLOW
1) A Data Flow has only one direction of flow between symbols. It may flow in both directions between
a process and a data store to show a read before an update. The later is usually indicated however by
two separate arrows since these happen at different type.
2) A join in DFD means that exactly the same data comes from any of two or more different processes
data store or sink to a common location.
3) A data flow cannot go directly back to the same process it leads. There must be at least one other
process that handles the data flow produce some other data flow returns the original data into the
beginning process.
4) A Data flow to a data store means update (delete or change).
5) A data Flow from a data store means retrieve or use.
A data flow has a noun phrase label more than one data flow noun phrase can appear on a single arrow as
long as all of the flows on the same arrow move together as one package.
74
74
4.2 INPUT DESIGN
Input design is a part of overall system design. The main objective during the input design as given
below:
To produce cost-effective method of input
Input States:
The main input stages can be listed as below:
Data recording
Data transcription
Data conversion
Data verification
Data control
Data transmission
Data validation
Data correction
Input Types:
It is necessary to determine the various types of input. Inputs can be categorized as follows:
External Inputs which are prime inputs for the system.
74
Input Media:
At this stage choice has to be made about the input media. To conclude about the input media
consideration has to be given to:
Type of Input
Flexibility of Format
Speed
Accuracy
Verification methods
Rejection rates
Ease of correction
User Registration: The first step in any online shopping project is user registration. Design a
registration form that collects all the necessary details such as name, email address, password, and
shipping address.
Product Catalog: You need to create a product catalog that will display all the products available
for purchase. Ensure that the catalog is user-friendly and easy to navigate. The catalog should also
have filters that allow the user to search for products based on specific criteria.
Product Details: When a user clicks on a product from the catalog, they should be taken to a
product details page that provides more information about the product, including price,
description, and product images.
Shopping Cart: A shopping cart is essential for any online shopping project. Users should be able
to add items to their cart and view the total cost of the items in their cart. Make sure that the
shopping cart is visible and easily accessible from any page on the website.
Checkout: When the user is ready to checkout, they should be taken to a checkout page where
they can review their order, enter their shipping and billing information, and choose a payment
method.
Order Confirmation: Once the order is placed, the user should receive an order confirmation
email that includes details about their order and estimated delivery time.
User Account: Design a user account page where users can view their order history, update their
profile information, and manage their shipping and billing addresses.
74
4.3 OUTPUT DESIGN
Outputs from computer systems are required primarily to communicate the results of processing to users.
They are also used to provide a permanent copy of the results for later consultation. The various types of
outputs in general are:
External Outputs, whose destination is outside the organization,.
Internal Outputs whose destination is within organization and they are the
User’s main interface with the computer.
Operational outputs whose use is purely within the computer department.
Interface outputs, which involve the user in communicating directly with User Interface.
Output Definition:
Database design can be generally defined as a collection of tasks or processes that enhance the designing,
development, implementation, and maintenance of enterprise data management system. Designing a
proper database reduces the maintenance cost thereby improving data consistency and the cost-effective
measures are greatly influenced in terms of disk storage space. Therefore, there has to be a brilliant
concept of designing a database. The designer should follow the constraints and decide how the elements
correlate and what kind of data must be stored.
The main objectives behind database designing are to produce physical and logical design models of the
proposed database system. To elaborate this, the logical model is primarily concentrated on the
requirements of data and the considerations must be made in terms of monolithic considerations and
hence the stored physical data must be stored independent of the physical conditions. On the other hand,
the physical database design model includes a translation of the logical design model of the database by
keep control of physical media using hardware resources and software systems such as Database
Management System (DBMS).
74
CHAPTER V
74
5.1 TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It is the
process of exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific testing
requirement.
TYPES OF TESTS
Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches and internal
code flow should be validated. It is the testing of individual software units of the application .it is done
after the completion of an individual unit before integration. This is a structural testing, that relies on
knowledge of its construction and is invasive. Unit tests perform basic tests at component level and test a
specific business process, application, and/or system configuration. Unit tests ensure that each unique path
of a business process performs accurately to the documented specifications and contains clearly defined
inputs and expected results.
Integration testing
Integration tests are designed to test integrated software components to determine if they actually
run as one program. Testing is event driven and is more concerned with the basic outcome of screens or
fields. Integration tests demonstrate that although the components were individually satisfaction, as shown
by successfully unit testing, the combination of components is correct and consistent. Integration testing is
specifically aimed at exposing the problems that arise from the combination of components.
Functional test
Functional tests provide systematic demonstrations that functions tested are available as specified
by the business and technical requirements, system documentation, and user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures: interfacing systems or procedures must be invoked.
Organization and preparation of functional tests is focused on requirements, key functions, or special
test cases. In addition, systematic coverage pertaining to identify Business process flows; data fields,
predefined processes, and successive processes must be considered for testing. Before functional testing is
complete, additional tests are identified and the effective value of current tests is determined.
74
System Test
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the configuration
oriented system integration test. System testing is based on process descriptions and flows, emphasizing
pre-driven process links and integration points.
Unit Testing:
Unit testing is usually conducted as part of a combined code and unit test phase of the software
lifecycle, although it is not uncommon for coding and unit testing to be conducted as two distinct phases.
Test objectives
All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.
Features to be tested
Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page
74
Integration Testing
Software integration testing is the incremental integration testing of two or more integrated
software components on a single platform to produce failures caused by interface defects.
The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level –
interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
SYSTEM IMPLEMENTATION:
Systems design
Conceptual design – what the system should do
Logical design – what the system should look to the user
Physical design – how the system should be built
Symbols
Components Symbol
Module Rectangle
Data couple Clear circle with out arrow
Control flag Filled circle with out arrow
Conditional processing/selection Diamond
Repetition A curved line intersecting the connection to the modules
Predefined module Rectangle with a vertical bar on each side
74
Cap and gown ordering system example
Step Example
Center Process #3: Validate Order
Root module Process Order
Primary inputs Student ID, cap size, gown size
Primary outputs Receipt, Order detail, Inventory update
Top-level Get student, Get order, Process invalid order, Process valid order
Refinement Get student, Get order, Process valid order
Implementation is the realization of a design so that it can be executed on a computer. This includes the
realization of: the system's classes; the user interface; and the database structures.
Testing comprises all activities to accomplish a satisfactory level of confidence that the system under
development fulfills it intended purpose. Objects of testing can be documents (such as specifications) or
software (such as a module or a complete system). The goal of testing is to find errors and remove the
causes of the errors.
Testing and implementation are obviously closely connected. If a concept is to be executed on a computer,
as the definition of “implementation” states, then the implementation must run without errors, otherwise
the concept has not been implemented (or at least not correctly implemented). In practice, implementation
and testing go hand-in-hand. This aspect will be discussed later, in section 6.2. First we will consider the
basic methods and tools for implementation.
74
SERVER SIDE VALIDATION
Some checks cannot be applied at client side. Server side checks are necessary to save the system
from failing and intimating the user that some invalid operation has been performed or the performed
operation is restricted. Some of the server side checks imposed is:
Server side constraint has been imposed to check for the validity of primary key and foreign key. A
primary key value cannot be duplicated. Any attempt to duplicate the primary value results into a
message intimating the user about those values through the forms using foreign key can be updated
only of the existing foreign key values.
User is intimating through appropriate messages about the successful operations or exceptions
occurring at server side.
Various Access Control Mechanisms have been built so that one user may not agitate upon another.
Access permissions to various types of users are controlled according to the organizational structure.
Only permitted users can log on to the system and can have access according to their category. User-
name, passwords and permissions are controlled o the server side.
Using server side validation, constraints on several restricted operations are imposed.
74
TEST CASES
LOGIN FOR USER
74
USER REGISTRATION PAGE
Serial Description Expected Actual Result Result
No Result
1. User registration page 1 After After Passed
consist of detail submitting submitting
information about User information information
and a submit button to User User
submit the registration registration
information .Here user is page 2 should page 2 is
entering correct be displayed. displayed.
information.
2. If the information entered An error An error Passed
by user in incorrect or message should message is
left somewhere blank. be displayed occurred if the
and ask the user information is
to fill the incorrect or left
information blank.
again.
74
6. CONCLUSION
To conclude the description about the project: The project, developed using PYTHON and
SQLITE is based on the requirement specification of the user and the analysis of the existing
software development. This Complaint management software is designed for people who want to
Identification of the drawbacks of the existing system leads to the designing of computerized
system that will be compatible to the existing system with the system which is more users
The system Online shopping” has been designed and developed flexibly according
to the current requirements. Depending upon the requirements of the user in future “A Multi-Tier
Enterprise Application for Online shopping” system can be updated in a much reliable manner.
74
.
BIBLIOGRAPHY
[1] S. Chen and L. Tong, “iEMS for large scale charging of electric vehicles: Architecture
and optimal online scheduling,” in Proceedings of IEEE International Conference on Smart
Grid Communications, Tainan City, Taiwan, Nov. 2012.
[2] N. Chen, T. Q. S. Quek, and C. W. Tan, “Optimal charging of electric vehicles in smart
grid: Characterization and valley-filling algorithms,” in Proceedings of IEEE International
Conference on Smart Grid Communications, Tainan City, Taiwan, Nov. 2012.
[3] A. Y. S. Lam, L. Huang, A. Silva, and W. Saad, “A multi-layer market for vechicle-to-
grid energy trading in the smart grid,” in Proceedings of 1st IEEE INFOCOM Workshop on
Green Networking and Smart Grids, Orlando, FL, Mar. 2012.
[4] A. Y. S. Lam, K.-C. Leung, and V. O. K. Li, “Capacity management of vehicle-to-grid
system for power regulation services,” in Proceedings of IEEE International Conference on
Smart Grid Communications, Tainan City, Taiwan, Nov. 2012.
[5] J. J. Q. Yu, V. O. K. Li, and A. Y. S. Lam, “Optimal V2G scheduling of electric
vehicles and unit commitment using chemical reaction optimization,” in Proceedings of
IEEE Congress on Evolutionary Computation, Cancun, Mexico, Jun. 2013.
http://www.w3schools.com/html/html_intro.asp
http://www.w3schools.com/css/css_background.asp
http://www.w3schools.com/php/php_forms.asp
74
ANNEXURES
APPENDICIES
UML Diagrams:
Actor:
A coherent set of roles that users of use cases play when interacting with the use
`cases.
Use case:
A description of sequence of actions, including variants, that a system performs that yields
an observable result of value of an actor.
UML stands for Unified Modeling Language. UML is a language for specifying,
visualizing and documenting the system. This is the step while developing any product
after analysis. The goal from this is to produce a model of the entities involved in the
project which later need to be built. The representation of the entities that are to be used in
the product being developed need to be designed.
There are various kinds of methods in software design:
They are as follows:
Use case Diagram
Sequence Diagram
Collaboration Diagram
Activity Diagram
State chat Diagram
USECASE DIAGRAMS:
74
Use case diagrams model behavior within a system and helps the developers
understand of what the user require. The stick man represents what’s called an actor.
Use case diagram can be useful for getting an overall view of the system and clarifying
who can do and more importantly what they can’t do.
Use case diagram consists of use cases and actors and shows the interaction between the
use case and actors.
The purpose is to show the interactions between the use case and actor.
To represent the system requirements from user’s perspective.
An actor could be the end-user of the system or an external system.
USECASE DIAGRAM:
A Use case is a description of set of sequence of actions. Graphically it is rendered
as an ellipse with solid line including only its name. Use case diagram is a behavioral
diagram that shows a set of use cases and actors and their relationship. It is an association
between the use cases and actors. An actor represents a real-world object. Primary Actor
– Sender, Secondary ActorReceiver.
A)
74
User Registration and products
74
74
74
.DATAFLOW DIAGRAMS:
DATAFLOW DIAGRAM
Level 0:
Level 1:
Login
Old User Process Product tblpro
View
Order
New Process tblorder
New User User
Registe
r
tbluser
74
Level 2 :
tblpro
Authorized Authorized Product
User/Admin User View
Order tblorder
Entry
Product
Entry
Report
tblpro
Order
View
tblorder
74
. ADMIN OVER ALL DFD
74
ER DIAGRAM
S. FIELD DATA
CONSTRAINT
NO NAME TYPE
1 Uid Varchar(50) Not
Null
2 Username Varchar(100) Not
Null
3 Password Varchar(30) Not
Null
4 creation Date Varchar(50) Not
Null
5 Updationdate Varchar(50) Not
null
74
TABLE NAME: ORDER
Primary key: orderid
S. FIELD DATA
CONSTRAINT
NO NAME TYPE
74
TABLE NAME: ORDER TRACK HISTORY
Primary key : userid
S. FIELD DATA
CONSTRAINT
NO NAME TYPE
1 Id Varchar(30) User id
74
11 Productimage3 Varchar(50) Not null
74
TABLE NAME: PRODUCT REVIEWS
S. FIELD DATA
CONSTRAINT
NO NAME TYPE
1 Id Varchar(30) User id
74
TABLE NAME: User log
S. FIELD DATA
CONSTRAINT
N NAME TYPE
O
1 Uid Int(11) Not Null
74
TABLE NAME: USERS
S. FIELD DATA
CONSTRAINT
N NAME TYPE
O
1 Id Int(11) Not
Null
2 Name Varchar(255) Default
null
3 Email Varchar(255) Default
null
4 Contact no Varchar(100) Default
null
5 Password Varchar(255) Default
null
74
SAMPLE SCREENS:
HOME PAGE:
74
USER LOGIN PAGE
74
PRODUCT
ADMIN LOGIN
74
ADMIN -> CART DETAILS
74
ADMIN -->USER DETAILS --> ADD USER DETAILS
74
USED PRODUCT
USER DETAILS
74
REGISTER
REGSITRER
74
SAMPLE CODING:
74