Efficient Way of Web Development Using Python and Flask

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Vangala Rama Vyshnavi et al.

International Journal of Recent Research Aspects ISSN: 2349-7688,


Vol. 6, Issue 2, June 2019, pp. 16-19

Efficient Way of Web Development


Using Python and Flask
Vangala Rama Vyshnavi, Amit Malik
Department of Computer Science and Engineering, SRM University Haryana, India
Abstract: Web is the most frequently and rapidly used networking aid which satisfies the requirements of all type of
users and which provides a solution for any type of problem. For designing and developing such well defined and
well structured, we have to choose a proper technology. Therefore a dynamic web application or portal can be
developed by using flask and python. Various applications such as hand gestures can be easily developed by python
which helps various people. Good development of a web page or an application can be easily attract users which
leads to success of the project. The technological needs of a web development project can be achieved by using
“python” and “flask”.

Keywords: Web development, templates, python, flask, Jinja, opencv, pages, hand gestures

I. INTRODUCTION
Python is a popular programming language. It
How Python web development is efficient using Flask: was created by Guido van Rossum, and released in 1991.
It is used for Web development, server development,
Python is a general purpose, high level programming
mathematics, system scripting.
language that focuses on the code readability, for web
Python works on different platforms (Windows,
development lines of code will be fewer than other
Mac, Linux, Raspberry Pi, etc). Python has a simple
languages. It is possible for Python because of large
syntax similar to the English language. Python has syntax
standard libraries which make the Web development code
that allows developers to write programs with fewer lines
simple and short. These libraries have pre-coded
than some other programing languages. Python can be
functions provided by Python community which can be
treated in a procedural way, an object-oriented way or a
easily downloaded and can be used as per the
functional way. Python runs on an interpreter system,
development needs. Initially Python was designed for
meaning that code can be executed as soon as it is written.
web designed for web servers to deal with the incoming
This means that Prototyping can be very quick.
traffic on the server.
a) Features of Python:
Flask uses Jinja Template Engine and the
(i) Small Core
Werkzeug WSGI ToolKit. Flask structures categories
(ii) Clear, Concise, and Orthogonal Syntax
into two parts “Static files & Template files”, template
(iii) Self Documenting
file have all the Jinja templates including Html pages,
(iv) Easy supports for default arguments
whereas static file have all static codes needed for website
(v) Object-Oriented file handling
such as CSS code, JavaScript code and Image files.
(vi) Method Chaining
B. Technical Advantages:
a. Robust
Robustness is the ability of system to cope with errors
during execution. Robustness is also used as the ability of
an algorithm to continue operating despite abnormalities
in input, calculations, etc. robustness can encompass
many areas of web development.
b. Open Source:
Python & Flask are an open source languages in which
the source code is available to the general public for use
and/or modification from its original design. Open-
source code is typically a collaborative effort where other
developers can improve upon the source code and share
the changes within the community so that order members
can help improve it further.
Introduction to Python: Introduction to Flask:

© 2019 IJRRA All Rights Reserved page - 16 -


Vangala Rama Vyshnavi et al. International Journal of Recent Research Aspects ISSN: 2349-7688,
Vol. 6, Issue 2, June 2019, pp. 16-19
From flask import Flask
App= Flask(__name__)
@app.route(‘/’)
def hello_world():
return ‘Hello World!’
if__name__= =’__main__’:
Flask is a web framework. This means flask provides you
app.run()
with tools, libraries and technologies that allow you to
build a web application. This web application can be web
pages, a blog, a wiki or go as a web-based calendar
application or a commercial website. Flask is a
lightweight web application framework written in Python b) Template Inheritance:
and baseband on the WSGI toolkit and Jinja2 template
Template Inheritance in Flask allows developers
engine. Flask is part of the Categories of the micro-
to build a base template which can be overridden by child
framework. Micro-framework are normally frame-work
with little to no dependencies to external libraries. template. It uses {%block%} and tells base template that
a) Features of Flask: child template may override the functionality defined in
(i). Integrated supports for Unit Testing {%block%}. {%extends %} section defines that this
(ii). Uses Jinja2 Templating template can “extend” another template. When the
(iii). Supports for secure cookies template system evaluates this template, first it locates the
(iv). Extensive documentation parent. The extends tag must be first in the template. To
(v). Google app engine compatibility provide the contents of a block defined in the parent
(vi). Restful request dispatching template, use {{super()}}.
Introduction to OPENCV:
Opencv Python is a library of Python bindings Index.html:
design to solve computer vision problems. It is the
Python API for Opencv. It was built to provide a common {%extends “layout.html” %}
infrastructure for applications and to accelerate the use of {%block content %}
machine perception. <hl>Say something</hl>
It supports a large variety of programming <form method=”post” action=”{{ url_for(‘signup’)
languages such as C++, JAVA etc and available for }}”> <p> <label> Username:</label>
different platforms for high speed operations. Opencv <input type=”text” name=”username”
Python makes use of Numpy which is highly optimise required> </p> <p> < label> Message:</label>
library for numerical operations. It is free of cost and it <textarea name=”message”> </textarea> </p>
can be written in any language. <p> <button type=”submit”>Send
It’s applications areas include recognition </button> </p>
systems, object identifications, tracking etc. It includes a </form>
statistical machine learning Library that contains neural {
networks, decision tree and maximization algorithms . {% endblock %}

II. IMPLEMENTATION OF BASIC PAGES message.html:


{% extends “layout.html” %}
A. The Support from Creation of Decorative {% block content %}
Template by Using Flask: <hl>{{ username }} said:</hl>
<p>
a) Hello World Program: {{ message
The basic example of Flask is a Hello World }} </p>
<a href=”{{ url_for(‘home’) }}”> Say something
program in Flask where we are importing Flask class
Else</a> {% endblock %}
using import function, then we are defining hello world
function and then returning ‘Hello World!’

© 2019 IJRRA All Rights Reserved page - 17 -


Vangala Rama Vyshnavi et al. International Journal of Recent Research Aspects ISSN: 2349-7688,
Vol. 6, Issue 2, June 2019, pp. 16-19
Layout.html:  Motion detection and thresholding
<!doctype html>  Contour Extraction
<html lang=”en”>  Count my fingers
<head>
 Four intermediate steps
<title>Say something</title>
<meta http-equiv=”content-type”  Contours
content=”text/html;  Bitwise AND
Charset=utf-8”>  Euclidian distance
<link rel=”shortcut icon” href=”{{ url_for(‘static’,  Convex Hull
Filename=’favicon.ico’) }}”>
</head> IV. RESULT
<body>
{% block content %} {% endblock %} After implementation we can run our project and see the
</body> output. After access the web camera and it should not be
</html> shake during the calibration period of 30 frames. After
that, you can use bring in your hand into the bounding
box, show gestures and the count of fingers will be
displaced accordingly.
c) File Organization:

File Organization is used to define the way in


which the files are arranged in the directory and it shows
the way in which they can be called. Example “/” is used
to define the index page.

Example/
__init__.py
static/
favicon.ico
templates/
index.html
hello.html

How Python will support web development in V. FUTURE SCOPE


applications:
Python and Flask are portable and interactive languages
Example: for web development including dynamic semantics
potential. In python it is also possible to bind new
Hand gestures is an application which is efficiently
modules to python to extend its core functionality. Many
designed in python by using some external libraries like
of the great websites are moving to python due to its
opencv. The opencv is the library which can be used in
robustness .It can be of great databases and very easy way
the real time applications which advantages in multicore
to use standard libraries. Powerful text processing is also
processing. Opencv, in this project is used to capture
enabling. Python is a fast growing technology having
video from the camera as a input from the user side.
many features.
Gesture recognition has been a very interesting problem
in computer vision for a long time. This is particularly VI. CONCLUSION
due to the fact that segmentation of foreground object
from a clustered background is a challenging problem in This paper can conclude as python can be more efficient
real time. than any other web development languages, because
python is fast, broad and better than java, perl, tcl etc.
III. IMPLEMENTATION Python Jinja flask are more useful for maintaining
complexity technologies. These are also helps for data
In this implementation we are implementing few contents
fetch from WWW. It is more powerful, fast with the help
using opencv and python for gestures.
of flask Template Engine. Therefore python is great for
 Segment the hand region backend web development.
 Background subtraction

© 2019 IJRRA All Rights Reserved page - 18 -


Vangala Rama Vyshnavi et al. International Journal of Recent Research Aspects ISSN: 2349-7688,
Vol. 6, Issue 2, June 2019, pp. 16-19
REFERENCES:

[1]. International Journal of Advanced Research in


Computer[ISSN No.0976-5697]
[2]. http://core.ac.uk/download/pdf/55305148.pdf
[3]. By Armin Ronacher, “Flask Web Development,
One Drop at a Time”,
http://flask.pocoo.org/,March 20th 2015.
[4]. By Armin Ronacher ”The Templates”,
http://flask.pocoo.org/docs/0.10/tutorial/templa
tes/,March 20th 2015
[5]. ByPhilipGuo,
http://www.pgbovine.net,July2014
[6]. By Sheetal Taneja, Pratibha R.Gupta “Python as
a Tool for Web Server
ApplicationDevelopment”
https://www.jimsindia.org/8i_journal/volumeii/
python-as-a-tool-for-web-server-application-
development.pdf Jan 2014.
[7]. Kubica,Marek, “How to use Python in the web.”
https://docs.python.org/2/howto/webservers.ht
ml.
[8]. Grove, Ralph F. “Web based Application
Development.” Jones &Bartlett Publishers,
2009.
[9]. “Django.” https://www.djangoproject.com

© 2019 IJRRA All Rights Reserved page - 19 -

You might also like