A platform that helps in writing web applications with the help of some package sand module is known as a framework.
When we work on the framework in python, we will not be worrying about every low level and minute detail like thread management, sockets, and protocols.
It gives flexibility to the user to focus on the logic of the application and the basic routine monotonous project.
The provision of some common patterns is ensured by the fast, reliable, and easy-to-maintain frameworks.
Python is one of the high-level programming languages most used and is designed to look more like human language.
If you are starting to program now and are looking for a simple language to learn, Python is the best option precisely because it is easy to learn and very efficient.
Uses of a framework
Following are the uses of the framework:
- Provides security to the user
- Efficient and smooth to work
- Good documentation
In this article, we will review some Python-based Web application frameworks.
Zope 2 is a Python-based Web application framework, tools originator. Its “objects release” system is very suitable for object-oriented development method and can reduce the learning curve for developers
Zope’s name means “Z Object Publishing Environment” (in Portuguese, “Z object publishing Environment”). Many Zope Server Administration tasks can be performed via a web interface.
The objects that Zope publishes on the Web are written in Python, and typically stored in an object database, ZODB, which is integrated into the system.
Basic objects such as documents, images, and page templates can be created or modified via the web. Specialized objects, such as wikis, blogs, and photo galleries are available as additional components (called products), and there is a thriving community of small businesses creating web applications like products.
Web2py written for Python is a free open source Web framework that aims agile rapid development of Web applications, with fast, scalable, secure and portable database-driven applications, It follows LGPLv3 open source license.
Web2py provides a one-stop solution for the entire development process that can be carried out on the browser. It provides a Web version of the online development, HTML template preparation, static file upload, writes database functions, log function, and automatic admin interface.
web2py is a free and lightweight framework 100% written in Python and based on Ruby on Rails and Django. According to the official website, “the web2py differs from the Rails as it is written in Python and, according to the creator, because it is written in Python, the web2py is faster and more scalable than Rails.
It is worth mentioning that it’s not a scalability issue strictly connected to the language or framework, but rather to the design of the software.
The web2py project was inspired by the Ruby on Rails and Django frameworks and was originally designed as a teaching tool with an emphasis on ease of use.
One of its main objectives is agility in the development of secure web applications based on databases.
The framework follows the MVC model ( Model-View-Controller ), which allows for better code organization.
It is also self-contained, that is, everything you need to develop an application is already part of your libraries, just unzip and start developing.
As the main focus is on letting the developer think about the application he is developing, instead of thinking about the code, web2py has integrations with a large number of databases, such as MSSQL, MySQL, Postgres, Oracle, MongoDB, and Google Big Table.
In addition, web2py integrates several sub-systems that allow the automatic creation of forms with automatic validation, authentication, and authorization, AJAX code generator for better user interaction with the application, secure file upload, plugin system, integration with various Web standards ( XML, RSS, etc. ), among others.
Web.py is a lightweight open-source Python Web framework, compact and flexible, simple yet very powerful when. Currently, Web.py is being widely used by some social networking sites such as Spain Frinki.
This framework is scalably developed with its own web-based IDE. It does not support Python3. Its features include a separate code editor, debugger, and one-click positioning.
Pyramid is a lightweight open-source Python Web framework that is part of the project Pylons. Pyramid only runs on Python 2.x or 2.4 later version.
Pylons provide an object-oriented implementation of MVC, but “outsourcing” a little service. In the model layer, it is possible to work with models like the storage engine of Google App Engine (BigTable), CouchDB, or ORM/DAL SQL Alchemy.
The layer views, supports template systems like Mako, Genshi, and Jinja2. In some ways, the Pylons is a “controller integrated with other tools.”
Django, The Open source web framework
Django is an open-source full-stack python framework and includes default features. We can download it for free from the internet. The framework asks us not to repeat any process as it follows the DRY principle.
PostgreSQL, MySQL, SQLite, Oracle are the databases that work on this framework.
It has a high-level structure that optimizes the development of applications, having a variety of libraries for which it requires less coding and large reuse of components, which will ensure consistency for medium and large projects.
Django Main features
Some of its main features are the authentication and authorization mechanism, administrative interface, friendly URLs, template system, cache integrated to Memcached, URL routing, support for multi-language applications (internationalization).
In addition to implementing the MTV models ( Model-Template-View ) in order to segment the application’s functionalities and the ORM ( Object Relational Mapper ) for the mapping of its objects to database tables.
Django’s structure supports several databases such as PostgreSQL, MySQL, and Oracle, and even though it officially supports NoSQL databases, there are a number of projects and forks that allow it to work.
A positive aspect of Django’s structure is its continuous evolution in order to keep up with the latest trends in application development.
This makes it a fantastic option for the development and maintenance of large sites, such as Pinterest, Instagram, Bitbucket, Mozilla, Disqus, and The Washington Times.
CubicWeb is not just a Web development framework, but also a Semantic Web development framework. CubicWeb uses relational query language (RQL Relation Query Language) to communicate with the database.
Twisted is a networking engine written in Python, which supports a number of protocols (including HTTP, NNTP, IMAP, SSH, IRC, FTP, and more). contains a Web server, multiple chat clients, mail servers, which is composed of numerous sub-projects with several reactors which you can choose.
It has an extension in C to speak with epoll, uses the PyKQueue to talk with kqueue, python itself can speak with select and poll, and uses the Win32 python toolkit to use NON-YIELDING IOCP.
Flask the micro framework
Flask is a lightweight micro-framework, and it is easily adaptable to the user’s requirements because of its modular designs. Some of the flask features are a quick debugger, a built-in development server, secure cookies support, integrated support for testing the units, etc.
The Flask is also a web framework written in Python, based on libraries WSGI Werkzeug and Jinja2, and inspired by the Sinatra Ruby framework.
The main objective of the framework is to provide a simple model for web development while having the flexibility to use the Python language.
It is called a micro-framework for maintaining a simple, yet extensible core.
It does not have a database abstraction layer, forms validation, or even any other component, however, third-party libraries provide these functionalities.
The simplicity of this framework leads to a smoother learning curve.
The Flask was published in April 2010 under the BSD license, having been designed for open source applications without, however, preventing you develop your code the way you need it.
In addition, it tries to follow Python’s Zen premises, generating codes with high readability and in good intentions, “ good intentions ”.
Compared to Django, Flask is more suitable for small projects, even though they have been used by large companies like Linkedin and Pinterest.
CherryPy, for agile development
It is a framework that uses the least approach for developing web applications and is open source. The web applications that are created are similar to the object-oriented writing program.
The CherryPy, published in 2002 under the BSD license, is an object-oriented open-source framework that incorporates a web server thread pool, installs, and brick structure.
Its structure allows implementing complex applications in a fast and efficient way, having for this purpose a variety of libraries, requiring less coding and a great reuse of components, thus ensuring consistency in projects.
It is a framework for agile development of web applications, object-oriented, allowing the use of any type of technology to access data, models, etc.
As it is an extensible framework, it allows developers to incorporate any Python module and forget, from a technical point of view, that it is an application for the web.
The CherryPy can be a proper web server or run through any environment WSGI compatible, such as Apache.
CherryPy allows you to create large web applications as it develops a simple object-oriented application and its pretty stable.
Tornado is a non-blocking web server that is used by FriendFeed. It is simpler to use than Twisted because it implements all the protocols that Twisted supports.
Similarly, it uses an extension in C to speak directly with epoll on Linux 2.6 is, otherwise it can use select only, so it does not take full advantage of platforms like * BSD, Mac, Windows, and Solaris.
Kivy is a “library” or “framework” for the development of GUI applications. It was developed to support the development of the project Stoq, supported by Async Open Source and the PIPE Fapesp.
The Kiwi lets you create interfaces using Glade, libglade library, and facilitate the work. It provides advanced behavior for components like ordered lists, autocompletes, bold colors, and validation.
Bottle: the fast, simple and lightweight Python framework
This framework was developed to create the APIs. Being a micro-framework, it implements everything available on the source files. Apart from the Python Standard Library, it is not dependent on other libraries. It is used for templating, routing, and accessing cookies, data and file uploads, etc.
The Bottle, published in 2009 under the license MIT, is a micro-framework WSGI fast, simple, and lightweight designed and distributed as a single file module and no dependencies beyond the standard library Python. It can be run with Python 2.5+ and 3.x.
It was originally developed for the creation of Web APIs, including ready-made features for routing to clean and dynamic URLs, support for mako, jinja2, and cheetah templates.
It provides utilities for data formation, file uploads, facilitates work with cookies, data from headers, and other metadata related to HTTP, in addition to integrating and supporting different HTTP servers.
The main idea of Bottle is to be as simple as possible, so that it grows according to the real need of the project, in addition to being very simple to understand its concepts.
And you, who also program in Python, what is your favorite framework and what do you consider the biggest advantages? Tell us in the comments!