A Web framework is a collection of packages or modules which allow developers to write Web applications or services without having to handle such low-level details as protocols, sockets, or process/thread management.
The majority of Web frameworks are exclusively server-side technology, although, with the increased prevalence of AJAX, some Web frameworks are beginning to include AJAX code that helps developers with the particularly tricky task of programming (client-side) the user’s browser. At the extreme end of the client-side Web, Frameworks is a technology that can use the web browser as a full-blown application execution environment (a Gmail for example).
Types of Python Frameworks
- Full-Stack Framework
Such frameworks are a one-stop-solution for all developer requirements. Form generators, form validation, and template layouts are usually available with a typical full-stack framework.
These are lightweight frameworks that don’t offer additional functionalities and features, such as database abstraction layer, form validation, and specific tools and libraries. Developers using a microframework need to add a lot of code and additional requirements manually.
- Asynchronous Framework
Gaining popularity recently, any asynchronous framework is a microframework that allows for handling a large set of concurrent connections. Typically, an asynchronous framework built for Python uses the programming language’s asyncio library.
Popular Full-Stack Frameworks
A web application may use a combination of a base HTTP application server, a storage mechanism such as a database, a template engine, a request dispatcher, an authentication module, and an AJAX toolkit. These can be individual components or be provided together in a high-level framework.
These are the most popular frameworks:
- Django: The Web framework for perfectionists (with deadlines). Django makes it easier to build better Web apps more quickly and with less code. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. It lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the DRY (Don’t Repeat Yourself) principle.
- Flask: Available under the BSD license, Flask is another popular Python framework. Inspired by the Sinatra Ruby framework, the microframework requires the Jinja2 template and the Werkzeug WSGI toolkit. Thanks to its lightweight and modular design, Flask is readily adaptable.
Flask allows the developers to build a solid web application foundation from where it is possible to use any kind of extensions required. The micro-framework is compatible with Google App Engine.
- Falcon: Aimed at rapidly building web APIs, Falcon is another widely used Python framework. Unlike other Python frameworks that require loading a lot of dependencies for building HTTP APIs, Falcon allows developers to build a cleaner design that enables HTTP and REST architectures.
As per the benchmark test conducted by Sanic, Falcon is able to handle most requests with the same hardware than all its contemporaries. The Python framework aims to have 100% code coverage. Falcon is used by big players like LinkedIn, OpenStack, and RackSpace.
- Tornado: framework The Tornado is an open-source Python framework and an asynchronous networking library. In addition to solving the C10k issue (which simply means to handle 10k connections at any given time), the asynchronous framework uses a non-blocking network I/O.
The Python framework was originally developed for a company called FriendFeed, which was acquired by Facebook in 2009. The Tornado is an ideal tool for building apps asking for high performance and several thousand concurrent users.
- Web2py: Python 2.7, Python 3.5+, PyPy All in one package with no further dependencies. Development, deployment, debugging, testing, database administration, and maintenance of applications can be done via the provided web interface, but not required.
web2py has no configuration files, requires no installation, can be run off a USB drive. web2py uses Python for the Model, View, and the Controller.
- Giotto: a Full-stack framework Based on the Model View Controller pattern, Giotto is an application framework for Python. In order to allow web designers, web developers, and system admins to work independently, Giotto separates Model, View, and Controller elements in order.
- Bottle: a fast and simple micro-framework for small web-applications. It offers request dispatching (Routes) with URL parameter support, Templates, key/value Databases, a build-in HTTP Server, and adapters for many third party WSGI/HTTP-server and template engines. All in a single file and with no dependencies other than the Python Standard Library.