Python is a versatile programming language. It is endowed with many frameworks and libraries that are well suited to Web application development. This article explores Python based frameworks that support the development of these applications.
Most government, social or corporate services are today available on cloud platforms in the form of Web applications that ensure 24×7 availability of services to users. These online services include that for e-governance, booking tickets and medical appointments, educational services, learning management systems, and many others.
A number of programming languages and rapid application development (RAD) frameworks are available today, which can be used to develop effective and high performance Web applications. Traditionally, programming languages like PHP, Python, Java, Ruby on Rails, and CGI-PERL have been used for Web development. Nowadays, Web frameworks are used instead, so that Web applications can be developed with fewer lines of code. In traditional programming (without frameworks), programmers were required to write thousands of lines of code, leading to many files of scripts. Such classical programming practices suffered from security issues, which Web frameworks help to avoid.
Currently, there are a number of frameworks for Web application development that provide security, integrity, clean coding and are also very effective in performance.
Table 1 lists the key platforms that can be used for the development of Web applications. These are efficient, accurate and give quick results.
Python is a powerful and lightweight programming language that is used in multiple domains for real-time applications including the following:
- High performance lightweight Web applications
- Blockchain programming
- Cryptocurrency development
- Cybersecurity and forensic applications
- Cloud and grid computing
- Artificial intelligence
- Data science and analytics patterns
- Machine learning and deep learning
- Natural language processing
Python based libraries and packages for Web application development
Python is enriched with numerous frameworks and libraries for developing different applications including Web applications. These frameworks are equipped with the latest Web services and functionalities including AJAX, assorted database connections, CURL, security mechanisms, cryptography, dynamic file handling, text analytics, regular expressions, and so on.
The frameworks for Web application development 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 lightweight but powerful framework for the development of Web applications using the Python programming environment. Complex and high performance Web applications can be developed and deployed using Flask very effectively. Very few lines of code are needed to program real-world applications, and there are no special requirements of dependencies on other libraries.
To work with the Flask framework in Python, the following instruction is executed first in a command prompt:
$ pip install flask
After the integration of Flask with the existing Python environment, the classical Web application 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 performance of the Flask framework is excellent for the object relational model (ORM) and the structured query language that are used for real-time applications. In addition, the execution time of Flask is very less.
Bottle | http://bottlepy.org |
Flask | https://palletsprojects.com/p/flask/ |
DJango | https://www.djangoproject.com/ |
AngularJS | https://angularjs.org/ |
NodeJS | https://nodejs.org/ |
Brackets | http://brackets.io/ |
ReactJS | https://reactjs.org/ |
Bootstrap | https://getbootstrap.com/ |
Atom | https://atom.io/ |
XAMPP | https://www.apachefriends.org |
EmberJS | https://emberjs.com/ |
WAMP | http://www.wampserver.com/en/ |
CSSTidy | http://csstidy.sourceforge.net/ |
Bower | https://bower.io/ |
Gulp | https://gulpjs.com/ |
GitLab | https://about.gitlab.com/ |
SASS | https://sass-lang.com/ |
LESS | http://lesscss.org/ |
HumbleFinance | http://www.humblesoftware.com/finance/index |
Table 1: Free and open source platforms for Web application development
Bottle framework
Bottle is another backend Web framework that is used for browser based applications. Simplicity and a single file distribution process are the key advantages of Bottle. In addition, it offers a lot of flexibility to expand its features, including many real-time features like templating and routing.
To install the Bottle framework in the Python environment, the following instruction is executed:
$ pip install bottle
The following is a programming paradigm in the Bottle framework that is quite simple and easy to execute:
from bottle import run, route, template @route(‘/hello/<myvar>’) def index(myvar): return template(‘<b>Hello {{myvar}}</b>!’, 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 requirements. 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 application development. The inclusion of database engines in these frameworks ensures that records can be managed effectively.