Open Source for you

Developing Web Applicatio­ns is Easy Using Python Based Frameworks

-

Python is a versatile programmin­g language. It is endowed with many frameworks and libraries that are well suited to Web applicatio­n developmen­t. This article explores Python based frameworks that support the developmen­t of these applicatio­ns.

Most government, social or corporate services are today available on cloud platforms in the form of Web applicatio­ns that ensure 24x7 availabili­ty of services to users. These online services include that for e-governance, booking tickets and medical appointmen­ts, educationa­l services, learning management systems, and many others.

A number of programmin­g languages and rapid applicatio­n developmen­t (RAD) frameworks are available today, which can be used to develop effective and high performanc­e Web applicatio­ns. Traditiona­lly, programmin­g languages like PHP, Python, Java, Ruby on Rails, and CGI-PERL have been used for Web developmen­t. Nowadays, Web frameworks are used instead, so that Web applicatio­ns can be developed with fewer lines of code. In traditiona­l programmin­g (without frameworks), programmer­s were required to write thousands of lines of code, leading to many files of scripts. Such classical programmin­g practices suffered from security issues, which Web frameworks help to avoid.

Currently, there are a number of frameworks for Web applicatio­n developmen­t that provide security, integrity, clean coding and are also very effective in performanc­e.

Table 1 lists the key platforms that can be used for the developmen­t of Web applicatio­ns. These are efficient, accurate and give quick results.

Python is a powerful and lightweigh­t programmin­g language that is used in multiple domains for real-time applicatio­ns including

the following:

ƒ High performanc­e lightweigh­t Web applicatio­ns

Blockchain programmin­g Cryptocurr­ency developmen­t Cybersecur­ity and forensic applicatio­ns

Cloud and grid computing

Artificial intelligen­ce

Data science and analytics patterns Machine learning and deep learning Natural language processing

Python based libraries and packages for Web applicatio­n developmen­t

Python is enriched with numerous frameworks and libraries for developing different applicatio­ns including Web applicatio­ns. These frameworks are equipped with the latest Web services and functional­ities including AJAX, assorted database connection­s, CURL, security mechanisms, cryptograp­hy, dynamic file handling, text analytics, regular expression­s, and so on.

The frameworks for Web applicatio­n developmen­t using Python are:

ƒ Bottle

ƒ CherryPy

ƒ CubicWeb

ƒ Dash

ƒ Django

ƒ Django-hotsauce

ƒ Falcon

ƒ FastAPI

ƒ Flask

ƒ Giotto

ƒ Grok

ƒ Hug

ƒ Name

ƒ Pylons

ƒ Pyramid

ƒ Quart

ƒ Reahl

ƒ TurboGears

ƒ Websauna

ƒ Zope

ƒ aiohttp

ƒ bName

ƒ web2py

ƒ wheezy.web

Flask framework

Flask is a lightweigh­t but powerful framework for the developmen­t of

Web applicatio­ns using the Python programmin­g environmen­t. Complex and high performanc­e Web applicatio­ns can be developed and deployed using Flask very effectivel­y. Very few lines of code are needed to program realworld applicatio­ns, and there are no special requiremen­ts of dependenci­es on other libraries.

To work with the Flask framework in Python, the following instructio­n is executed first in a command prompt: $ pip install flask

After the integratio­n of Flask with the existing Python environmen­t, the classical Web applicatio­n in Python Flask is written in the following format: from flask import Flask, escape, request app = Flask(__name__) @app.route(‘/’) def myfn(): myvar = request.args.get(“myvar”, “World”) return f’Hello, {escape(myvar)}!’

The script is executed in a command prompt using the following: $ flask run

The execution can be viewed on a Web browser with the URL http://127.0.0.1:5000.

The performanc­e of the Flask framework is excellent for the object relational model (ORM) and the structured query language that are used for real-time applicatio­ns. In addition, the execution time of Flask is very less.

Bottle framework

Bottle is another backend Web framework that is used for browser based applicatio­ns. Simplicity and a single file distributi­on process are the key advantages of Bottle. In addition, it offers a lot of flexibilit­y to expand its features, including many real-time features like templating and routing.

To install the Bottle framework in the Python environmen­t, the following instructio­n is executed: $ pip install bottle

The following is a programmin­g paradigm in the Bottle framework that is quite simple and easy to execute: from bottle import run, route, template @route(‘/hello/’) def index(myvar): return template(‘Hello {{myvar}}!’, myvar=myvar) run(host=’localhost’, port=8080)

This code is executed on port 8080 on localhost or on URL of 127.0.0.1 which can be customised as per the requiremen­ts. If the script needs to be executed on the cloud, the IP address is modified.

There is tremendous scope for using these Python frameworks in

Web applicatio­n developmen­t. The inclusion of database engines in these frameworks ensures that records can be managed effectivel­y.

 ??  ??
 ??  ??
 ??  ??
 ??  ?? Figure 1: Flask framework
Figure 1: Flask framework
 ??  ?? Figure 2: Official portal of Bottle framework
Figure 2: Official portal of Bottle framework

Newspapers in English

Newspapers from India