|By Jyoti Bansal||
|February 7, 2016 02:00 PM EST||
An Introduction to Python Frameworks - Part 1
By Omed Habib
Python began life in the late 1980s. It was developed by Guido van Rossum at Centrum Wiskunde & Informatica, a math and computer science research center in Amsterdam Science Park in the Netherlands. Van Rossum continues to be an influential figure in the development and guidance of Python. In fact, members of the Python community have bestowed upon him the regal title of Benevolent Dictator for Life (BDFL).
From those humble beginnings, Python has grown to become one of the most popular server-side languages on the Internet. According to W3Techs, it is used by more high-traffic sites than ColdFusion, PHP, and ASP.NET. More than 98 percent of those sites are running Python 2.0, and just over one percent are using 3.0.
Frameworks Makes Life Easier
Today, there is a wide variety of Python frameworks that make creating web applications much easier. These frameworks bring together the modules and packages that allow you to build applications quickly, without the need to take care of involved details, like sockets and protocols, all in one place.
In Part 1 of this two-part article series, we will examine some of the more popular Python frameworks. While most modern Web frameworks are used on the server, some are beginning to incorporate code that lets them run code on the client (e.g., Skulpt or Trinket). Python frameworks are often separated into full-stack and non-full-stack frameworks. Full-stack frameworks help developers create applications from the user experience right through to the database. Non-full-stack frameworks are those that handle anything less than complete development.
There are also micro-frameworks, which are non-full-stack frameworks less bloat. In some situations, it makes more sense to use a complement of micro-frameworks, while other applications demand a full stack. We will take a closer look at full-stack vs. micro-frameworks in Part 2 of this series.
Perhaps the Python framework with the highest profile is Django. It is an open-source framework that follows the architectural pattern of model-view-controller (MVC). It is named after Django Reinhardt, a French composer and guitarist who is widely considered one of the greatest guitar players in history. Two developers at the Lawrence Journal-World in Lawrence, Kansas, Adrian of Holovaty and Simon Willison, created Django in 2003 to build Web apps for the newspaper.
Django includes its own templating engine, as well as providing OOTB support for the widely popular Jinja2 engine. It also employs a regex based URL dispatcher, allowing complex mappings with very simple URLs.
One of Django's strengths has been that it is a single package install. Other alternatives require developers to hunt down many components just to get started. Also, Django always had extensive documentation, historically a weakness for open-source projects. It is a robust, well-integrated framework with many plug-ins and add-ons from the user community. Also, the community behind the project seems much more organized, as is evident with its thorough documentation and tutorials.
TurboGears is a framework built on top of several reputable Python projects, such as SQLAlchemy, WebOb, Repoze, and Genshi. In a sense, TurboGears takes the approach of gluing together already established open platforms. Like Django, it utilizes the MVC architecture. It recently also incorporated a "minimal mode," which allows it to act as a micro-framework.
TurboGears was developed by Kevin Dangoor in 2005. He distributed it as an open-source project in September of that year. In 2013, the project developers moved to support Python 3 and away from the Pylons code base they had been working with. Some of the advantages of TurboGears include:
- Strong support for aggregates
- Powerful object relational mapper
- Transaction system that takes care of multi-database transactions automatically
- Multi-database support
- Reusable snippets for templates
- Lots of flexibility to incorporate non-standard components
- Support for sharding
- Template systems that make life easier for designers
A few of the drawbacks of TurboGears includes a very basic admin, fewer third-party apps, and rudimentary documentation. A major challenge with TurboGears is that it can be overwhelming. Because it is mash-up of other components that offer infinite flexibility, it can be overwhelming when trying to decide which path to take to complete a task.
One open-source framework, web2py, allows developers to create dynamic, interactive websites quickly. It is designed to eliminate many of the repetitive programming tasks that slow down development, like creating basic forms. In the beginning, it was created as a teaching tool. It was modeled after Django and Ruby on Rails, a framework for the Ruby language. Like TurboGears, it uses the MVC architecture.
The original source code was released in 2007 by Massimo DiPierro. At that time, it was known as the Enterprise Web Framework (EWF). Due to naming conflicts, it changed names several times and settled on web2py on Version 1.16. Several applications created using web2py include the Movuca Content Management System, music site NoobMusic, a diagnostic tool for networks called LinkFindr and the Instant Press blogging platform. In 2011, web2py captured a Bossie Award for the best open-source development software. The following year, its winning ways continued when it brought home InfoWorld's Technology of the Year award.
Like Django, web2py has extensive documentation. New and advanced developers alike can download the Complete Reference Manual for free.
Some of web2py's advantages include:
- Easy to use. As a robust full-stack framework, it functions without any dependencies. This makes it easy to learn and deploy, as no configuration files are needed for installation. Once it is downloaded and installed, everything works. Developers get a database, a Web-based IDE, and a Web server as well as a powerful API with a number of core objects.
- Excellent security. Web2py's template language reduces the dangers of hackers using cross-site scripting. The abstraction layer prevents SQL injections while the forms created have field validation and stop cross-site request forgeries. Sessions are stored on the server to keep bad actors from messing with browser cookies, and every password is stored hashed.
Some drawbacks to web2py include:
- Not easy to use the administrative interface on a regular basis
- No permissions on the administrative interface
- No built-in unit testing support
- Rapid development. All functions have default behaviors. Forms are generated automatically, and high-level widgets and application grids are built in.
Flask is a Python micro-framework based on Jinja2 and Werkzeug. Similar to other frameworks, it is licensed under the Berkeley Software Distribution (BSD), a free software license that operates with few restrictions. Web sites that have used Flask include LinkedIn and Pinterest. It includes features such as:
- Built-in unit testing support
- Templating using Jinja2
- Extensive documentation
- Client-side sessions using secure cookies
- Development server and debugger
- RESTful request dispatching
- Compliant with WSGI version 1.0
- Unicode based
- Numerous extensions
Flask is a young framework that came on the scene in 2010. The philosophical objective of Flask is to not impose conventions on the programmer, allowing you to use your choice of DB ORM, templating engine, session middleware, or other components that your project requires. This is generally, in my opinion, the purpose of a ‘microframework'.
I would say that a framework like Flask is better suited to a more experienced developer, not necessarily just to smaller applications. Of course, if you just want to make a simple REST API, then Flask is definitely good bet.
Like Flask, Bottle is a WSGI Web framework. Distributed as a single file, it does not have any dependencies outside of the Python Standard Library. Written by Marcel Hellkamp in 2009, it has minimal tools to start including templating, routing and a WSGI abstraction layer. This small, powerful framework is great for programmers looking for flexibility and basic functionality, building simple applications and websites and creating a Web API.
Its advantages include:
- Fast template engine that comes built-in and supports Jinja2, Mako, and Cheetah
- Many utilities that can access uploads, cookies, form data, headers, and other metadata
- HTTP development server built-in that supports fapws3, Google App Engine, CherryPy and Paste
- Support for dynamic URLs
Another advantage of Bottle is that its small profile makes it easy to embed it within a larger application without worrying about system-wide dependencies. Bottle is for you if you want to create small apps with a simple, clean and fast framework that is not verbose.
It is hard to believe, but these are just a few of the dozens of Python frameworks available to developers. Python.org reports that Django, TurboGears, and web2py are the most popular full-stack options. Here we added two of the higher-profile micro-frameworks to provide a thorough look at the framework landscape. Other frameworks with enthusiastic followers include Pyramid, web.py, Bobo, Albatross and CherryPy.
Finding the Right Fit
Choosing the right framework depends on the size of the project, its communication needs, whether it is a standalone application or not, the level of customization that is needed, overhead and a number of other factors. Just as important, it depends on which framework feels right for your personal working style. Review these projects and download their latest release. Take a test drive to make sure you are in the right vehicle before planning a major trip.
The post An Introduction to Python Frameworks - Part 1 appeared first on Application Performance Monitoring Blog | AppDynamics.
Your homes and cars can be automated and self-serviced. Why can't your storage? From simply asking questions to analyze and troubleshoot your infrastructure, to provisioning storage with snapshots, recovery and replication, your wildest sci-fi dream has come true. In his session at @DevOpsSummit at 20th Cloud Expo, Dan Florea, Director of Product Management at Tintri, will provide a ChatOps demo where you can talk to your storage and manage it from anywhere, through Slack and similar services ...
Mar. 24, 2017 06:30 PM EDT Reads: 4,097
My team embarked on building a data lake for our sales and marketing data to better understand customer journeys. This required building a hybrid data pipeline to connect our cloud CRM with the new Hadoop Data Lake. One challenge is that IT was not in a position to provide support until we proved value and marketing did not have the experience, so we embarked on the journey ourselves within the product marketing team for our line of business within Progress. In his session at @BigDataExpo, Sum...
Mar. 24, 2017 06:30 PM EDT Reads: 2,595
What sort of WebRTC based applications can we expect to see over the next year and beyond? One way to predict development trends is to see what sorts of applications startups are building. In his session at @ThingsExpo, Arin Sime, founder of WebRTC.ventures, will discuss the current and likely future trends in WebRTC application development based on real requests for custom applications from real customers, as well as other public sources of information,
Mar. 24, 2017 05:30 PM EDT Reads: 356
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Mar. 24, 2017 05:15 PM EDT Reads: 1,282
SYS-CON Events announced today that Ocean9will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Mar. 24, 2017 04:45 PM EDT Reads: 1,757
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), will provide an overview of various initiatives to certifiy the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldw...
Mar. 24, 2017 03:56 PM EDT Reads: 211
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
Mar. 24, 2017 01:15 PM EDT Reads: 3,831
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
Mar. 24, 2017 01:15 PM EDT Reads: 551
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
Mar. 24, 2017 12:45 PM EDT Reads: 1,851
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
Mar. 24, 2017 12:15 PM EDT Reads: 1,386
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
Mar. 24, 2017 12:15 PM EDT Reads: 950
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Mar. 24, 2017 12:00 PM EDT Reads: 1,877
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
Mar. 24, 2017 12:00 PM EDT Reads: 1,633
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
Mar. 24, 2017 10:45 AM EDT Reads: 1,409
SYS-CON Events announced today that Infranics will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Since 2000, Infranics has developed SysMaster Suite, which is required for the stable and efficient management of ICT infrastructure. The ICT management solution developed and provided by Infranics continues to add intelligence to the ICT infrastructure through the IMC (Infra Management Cycle) based on mathemat...
Mar. 24, 2017 09:45 AM EDT Reads: 2,731
Now that the world has connected “things,” we need to build these devices as truly intelligent in order to create instantaneous and precise results. This means you have to do as much of the processing at the point of entry as you can: at the edge. The killer use cases for IoT are becoming manifest through AI engines on edge devices. An autonomous car has this dual edge/cloud analytics model, producing precise, real-time results. In his session at @ThingsExpo, John Crupi, Vice President and Eng...
Mar. 24, 2017 08:45 AM EDT Reads: 3,669
In the enterprise today, connected IoT devices are everywhere – both inside and outside corporate environments. The need to identify, manage, control and secure a quickly growing web of connections and outside devices is making the already challenging task of security even more important, and onerous. In his session at @ThingsExpo, Rich Boyer, CISO and Chief Architect for Security at NTT i3, will discuss new ways of thinking and the approaches needed to address the emerging challenges of securit...
Mar. 24, 2017 08:30 AM EDT Reads: 4,259
The taxi industry never saw Uber coming. Startups are a threat to incumbents like never before, and a major enabler for startups is that they are instantly “cloud ready.” If innovation moves at the pace of IT, then your company is in trouble. Why? Because your data center will not keep up with frenetic pace AWS, Microsoft and Google are rolling out new capabilities In his session at 20th Cloud Expo, Don Browning, VP of Cloud Architecture at Turner, will posit that disruption is inevitable for c...
Mar. 24, 2017 08:30 AM EDT Reads: 1,905
There are 66 million network cameras capturing terabytes of data. How did factories in Japan improve physical security at the facilities and improve employee productivity? Edge Computing reduces possible kilobytes of data collected per second to only a few kilobytes of data transmitted to the public cloud every day. Data is aggregated and analyzed close to sensors so only intelligent results need to be transmitted to the cloud. Non-essential data is recycled to optimize storage.
Mar. 24, 2017 08:15 AM EDT Reads: 2,896
As businesses adopt functionalities in cloud computing, it’s imperative that IT operations consistently ensure cloud systems work correctly – all of the time, and to their best capabilities. In his session at @BigDataExpo, Bernd Harzog, CEO and founder of OpsDataStore, will present an industry answer to the common question, “Are you running IT operations as efficiently and as cost effectively as you need to?” He will expound on the industry issues he frequently came up against as an analyst, and...
Mar. 24, 2017 08:00 AM EDT Reads: 4,007