Web2py
   HOME

TheInfoList



OR:

Web2py is an
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized so ...
web application framework written in the Python
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
. Web2py allows web developers to program
dynamic web content A server-side dynamic web page is a web page whose construction is controlled by an application server processing server-side scripts. In server-side scripting, parameters determine how the assembly of every new web page proceeds, and includin ...
using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a
form Form is the shape, visual appearance, or configuration of an object. In a wider sense, the form is the way something happens. Form also refers to: *Form (document), a document (printed or electronic) with spaces in which to write or enter data * ...
from scratch if required.Web2py (2013), What is web2py?, web2py.com, retrieved 11 October 2013, Web2py was originally designed as a teaching tool with emphasis on ease of use and
deployment Deployment may refer to: Engineering and software Concepts * Blue-green deployment, a method of installing changes to a web, app, or database server by swapping alternating production and staging servers * Continuous deployment, a software e ...
. Therefore, it does not have any project-level configuration files. The design of web2py was inspired by the
Ruby on Rails Ruby on Rails (simplified as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and we ...
and Django frameworks. Like these frameworks, web2py focuses on rapid development, favors convention over configuration approach and follows a
model–view–controller Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of info ...
(MVC)
architectural pattern An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. The architectural patterns address various issues in software engineering, such as computer hardware perfor ...
.


Overview

Web2py is a full-stack framework in that it has built-in components for all major functions, including: *
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide We ...
requests, HTTP responses,
cookies A cookie is a baked or cooked snack or dessert that is typically small, flat and sweet. It usually contains flour, sugar, egg, and some type of oil, fat, or butter. It may include other ingredients such as raisins, oats, chocolate chi ...
, sessions; * multiple protocols
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaS ...
/
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
, REST,
ATOM Every atom is composed of a nucleus and one or more electrons bound to the nucleus. The nucleus is made of one or more protons and a number of neutrons. Only the most common variety of hydrogen has no neutrons. Every solid, liquid, gas, a ...
and RSS, RTF and CSV,
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other se ...
, JSON-RPC and
XML-RPC XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism.Simon St. Laurent, Joe Johnston, Edd Dumbill. (June 2001) ''Programming Web Services with XML-RPC.'' O'Reilly. First Edition ...
, AMF-RPC ( Flash/
Flex Flex or FLEX may refer to: Computing * Flex (language), developed by Alan Kay * FLEX (operating system), a single-tasking operating system for the Motorola 6800 * FlexOS, an operating system developed by Digital Research * FLEX (protocol), a com ...
), and
SOAP Soap is a salt of a fatty acid used in a variety of cleansing and lubricating products. In a domestic setting, soaps are surfactants usually used for washing, bathing, and other types of housekeeping. In industrial settings, soaps are us ...
; * CRUD API; * multiple
authentication Authentication (from ''authentikos'', "real, genuine", from αὐθέντης ''authentes'', "author") is the act of proving an assertion, such as the identity of a computer system user. In contrast with identification, the act of indicatin ...
mechanisms and
role-based access control In computer systems security, role-based access control (RBAC) or role-based security is an approach to restricting system access to authorized users. It is an approach to implement mandatory access control (MAC) or discretionary access control ...
; *
database abstraction layer A database abstraction layer (DBAL or DAL) is an application programming interface which unifies the communication between a computer application and databases such as SQL Server, IBM Db2, MySQL, PostgreSQL, Oracle or SQLite. Traditionally, all da ...
(DAL) that dynamically generates SQL and runs on multiple compatible database backends; *
RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater tropical fish People * Ram (given name) * Ram (surname) * Ram (director) (Ramsubramaniam), an Indian Tamil film director * RAM (musician) (born 1974), Dutch * ...
, disk, and
memcached Memcached (pronounced variously ''mem-cash-dee'' or ''mem-cashed'') is a general-purpose distributed memory-caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of ...
-based caching for
scalability Scalability is the property of a system to handle a growing amount of work by adding resources to the system. In an economic context, a scalable business model implies that a company can increase sales given increased resources. For example, a ...
; *
internationalization In economics, internationalization or internationalisation is the process of increasing involvement of enterprises in international markets, although there is no agreed definition of internationalization. Internationalization is a crucial strateg ...
support; * jQuery for
Ajax Ajax may refer to: Greek mythology and tragedy * Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea * Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris * ''Ajax'' (play), by the ancient Gree ...
and UI effects; * automatic logging of errors with context. Web2py encourages sound
software engineering Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
practices such as * the
model–view–controller Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of info ...
(MVC) pattern; * self-submission of web forms; *
server-side In the client–server model, server-side refers to programs and operations that run on the server. This is in contrast to client-side programs and operations which run on the client. General concepts Typically, a server is a computer applicati ...
sessions; * safe handling of uploaded files. Web2py uses the
WSGI The Web Server Gateway Interface (WSGI, pronounced ''whiskey'' or ) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, ...
protocol, the Python-oriented protocol for
communication Communication (from la, communicare, meaning "to share" or "to be in relation with") is usually defined as the transmission of information. The term may also refer to the message communicated through such transmissions or the field of inqui ...
between
web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initia ...
and web applications. It also provides handlers for CGI and the
FastCGI FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a variation on the earlier Common Gateway Interface (CGI). FastCGI's main aim is to reduce the overhead related to interfacing between web server and CGI ...
protocols, and it includes the multi-threaded,
SSL SSL may refer to: Entertainment * RoboCup Small Size League, robotics football competition * ''Sesame Street Live'', a touring version of the children's television show * StarCraft II StarLeague, a Korean league in the video game Natural language ...
-enabled Rocket wsgiserver.


Distinctive features


Web-based integrated development environment (IDE)

All development,
debugging In computer programming and software development, debugging is the process of finding and resolving '' bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems. Debugging tactics can involve i ...
,
testing An examination (exam or evaluation) or test is an educational assessment intended to measure a test-taker's knowledge, skill, aptitude, physical fitness, or classification in many other topics (e.g., beliefs). A test may be administered verba ...
,
maintenance Maintenance may refer to: Biological science * Maintenance of an organism * Maintenance respiration Non-technical maintenance * Alimony, also called ''maintenance'' in British English * Champerty and maintenance, two related legal doct ...
and remote database administration can (optionally) be performed without third-party tools, via a web interface, itself a web2py application.
Internationalization In economics, internationalization or internationalisation is the process of increasing involvement of enterprises in international markets, although there is no agreed definition of internationalization. Internationalization is a crucial strateg ...
(adding languages and writing translations) can also be performed from this IDE. Each application has an automatically generated database administrative interface, similar to Django. The web IDE also includes web-based testing. Applications can also be created from the
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
or developed with other IDEs. Further debugging options: * Wing IDE allows graphical debugging of web2py applications as you interact with it from your web browser, you can inspect and modify variables, make function calls etc. *
Eclipse An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three c ...
/ PyDev — Eclipse with the Aptana PyDev plugin — supports web2py as well. * The extensible pdb debugger is a module of Python's standard library. * With the platform-independent open-source Winpdb debugger, one can perform remote debugging over
TCP/IP The Internet protocol suite, commonly known as TCP/IP, is a framework for organizing the set of communication protocols used in the Internet and similar computer networks according to functional criteria. The foundational protocols in the su ...
, through encrypted connection. The Hello World program with web2py in its simplest form (simple web page with no template) looks like: def hello(): return 'Hello World' Web2py includes pure Python-based template language, with no indentation requirements and a server-side Document Object Model ( DOM). The template system works without web2py.
Joomla Joomla (), also spelled Joomla! (with an exclamation mark) and sometimes abbreviated as J!, is a free and open-source content management system (CMS) for publishing web content on websites. Web content applications include discussion forums, ...
1.x templates can be converted to web2py layouts. Web2py also includes two markup libraries: the markdown2 text-to-HTML filter, which converts
Markdown Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown i ...
markup to HTML on the fly; and markmin which is inspired by markdown but supports tables, html5 video/audio and oembed protocol. A
controller Controller may refer to: Occupations * Controller or financial controller, or in government accounting comptroller, a senior accounting position * Controller, someone who performs agent handling in espionage * Air traffic controller, a person w ...
without a view automatically uses a generic view that render the variables returned by the controller, enabling the development of an application's business logic before writing HTML. The "Hello World" example using a default template: def hello(): return dict(greeting='Hello World') The dict() output of an action is automatically rendered in HTML if the page is request with a .html extension, in JSON if the page is requested with a .json extension, in XML if requested with .xml. It supports other protocols including jsonp, rss, ics, google maps, etc. and is extensible. Here is a more complex code example which defines a table, and exposes a grid to logged in users: db.define_table('thing',Field('name',notnull=True)) @auth.requires_login() def hello(): return dict(grid = SQLFORM.grid(db.thing))


Ticketing system

Each web2py application comes with a ticketing system: * If an error occurs, it is logged and a ticket is issued to the user. That allows error tracking. * Errors and source code are accessible only to the administrator, who can search and retrieve errors by date or client-IP. No error can result in code being exposed to the users.


Portable cron

Cron is a mechanism for creating and running recurrent tasks in background. It looks for an application-specific crontab file which is in standard crontab format. Three modes of operation are available: * Soft cron:
cron The cron command-line utility is a job scheduler on Unix-like operating systems. Users who set up and maintain software environments use cron to schedule jobs (commands or shell scripts), also known as cron jobs, to run periodically at fixed t ...
routines are checked after web page content has been served, does not guarantee execution precision. For unprivileged Apache CGI/WSGI installs. * Hard cron: a cron thread gets started on web2py startup. For Windows and Rocket/standalone web2py installs. * System cron: cron functions get force-called from the
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
, usually from the system crontab. For Unix/Linux systems and places where the cron triggers need to be executed even if web2py is not running at the moment; also good for CGI/WSGI installs if you have access to the system crontab.


Scheduler

Since version 2.3 the use of cron is discouraged since web2py comes with a master/worker scheduler. Jobs can be defined in models and are scheduled by creating an entry in the database. Users can start work processes who pickup and execute tasks in background. The schedule is better than cron because it allows to specify more parameters (start time, stop time, number of repetitions, number of trials in case of error) and do a better job at running within constant resource utilization.


Bytecode distribution

Web2py can compile web applications for distribution in
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
compiled form, without source code. Unlike frameworks that use specialized template languages for their views, Web2py can also compile the view code into bytecode, since it is pure Python code.


Global Environment

Web2py is unique in the world of Python web frameworks because models and controllers are executed, not imported. They are not modules. They are executed in a single global environment which is initialized at each HTTP request. This design decision has pros and cons. The major pro is the ease of development, specifically for rapid prototyping. Another pro is that all the objects defined within this environment are cleanly reset at each HTTP request and never shared across requests. This means the developer does not need to worry about changing the state of an object (for example the readable attribute of a database field) or worry about a change leaking to other concurrent requests or other applications. A third advantage is that web2py allows the coexistence of multiple applications under the same instance without conflicts even if they use different versions of the same modules or different modules with the same name. The main disadvantage of the global environment is that model files and controller files are not modules and the order of execution matters (although it can be specified using conditional models). Naming conflict is more likely to occur than in normal Python modules. Some standard Python development tools may not understand objects defined in models and controllers. Moreover, developers must be aware that code in models is executed at every request and this may cause a performance penalty. Nothing in web2py prevents developers from using and importing normal Python modules (model-less approach) and for this purpose web2py provides a thread local object (current) to facilitate access to objects associated to the current request. Yet, in this case, the developer has to be aware of the same pitfalls that other frameworks incur: changing the state of an object defined in a module may affect other concurrent requests. Another con is that, because models and controllers are not class-based, efficient code reuse becomes more difficult, particularly as the inability to inherit from a parent controller (e.g. the ApplicationController in Ruby on Rails) means that common controller functionality must be referenced repeatedly across all controller files.


Supported environments


Operating systems, Python versions & implementations, virtual machines, hardware

web2py runs on
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
,
Windows CE Windows Embedded Compact, formerly Windows Embedded CE, Windows Powered and Windows CE, is an operating system subfamily developed by Microsoft as part of its Windows Embedded family of products. Unlike Windows Embedded Standard, which is base ...
phones, Mac,
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, ...
/
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
,
Google App Engine Google App Engine (often referred to as GAE or simply App Engine) is a cloud computing platform as a service for developing and hosting web applications in Google-managed data centers. Applications are sandboxed and run across multiple servers ...
,
Amazon EC2 Amazon Elastic Compute Cloud (EC2) is a part of Amazon.com's cloud-computing platform, Amazon Web Services (AWS), that allows users to rent virtual computers on which to run their own computer applications. EC2 encourages scalable deployment of ...
, and almost any web hosting via Python 2.7/3.5/3.6/pypy. The current binary version of web2py (for Windows or Mac) includes Python 2.7, but the source version can be run on 2.7 and 3.5+. Support for Python 2.6 has been dropped on 2017. web2py since v1.64.0 runs unmodified on
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
with
Jython Jython is an implementation of the Python programming language designed to run on the Java platform. The implementation was formerly known as JPython until 1999. Overview Jython programs can import and use any Java class. Except for some stand ...
2.5, without any known limitation. web2py code can run with
IronPython IronPython is an implementation of the Python programming language targeting the .NET Framework and Mono. Jim Hugunin created the project and actively contributed to it up until Version 1.0 which was released on September 5, 2006. IronPython 2.0 ...
on .NET. Limitations: * no ''csv'' module (so no database I/O); * no third party database drivers (not even
SQLite SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the mo ...
, so no databases at all); * no built-in web server (unless you cripple it by removing ''signals'' and ''logging''). The web2py binary will run from a
USB drive A USB flash drive (also called a thumb drive) is a data storage device that includes flash memory with an integrated USB interface. It is typically removable, rewritable and much smaller than an optical disc. Most weigh less than . Since fir ...
or a portable hard drive without dependencies, like Portable Python.


Web servers

Web2py can service requests via
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide We ...
and
HTTPS Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP). It is used for secure communication over a computer network, and is widely used on the Internet. In HTTPS, the communication protocol is enc ...
with its built-in Rocket server, with
Apache The Apache () are a group of culturally related Native American tribes in the Southwestern United States, which include the Chiricahua, Jicarilla, Lipan, Mescalero, Mimbreño, Ndendahe (Bedonkohe or Mogollon and Nednhi or Carrizaleño a ...
,
Lighttpd lighttpd (pronounced "lighty") is an open-source web server optimized for speed-critical environments while remaining standards-compliant, secure and flexible. It was originally written by Jan Kneschke as a proof-of-concept of the c10k problem ...
,
Cherokee The Cherokee (; chr, ᎠᏂᏴᏫᏯᎢ, translit=Aniyvwiyaʔi or Anigiduwagi, or chr, ᏣᎳᎩ, links=no, translit=Tsalagi) are one of the indigenous peoples of the Southeastern Woodlands of the United States. Prior to the 18th century, th ...
,
Hiawatha Hiawatha ( , also : ), also known as Ayenwathaaa or Aiionwatha, was a precolonial Native American leader and co-founder of the Iroquois Confederacy. He was a leader of the Onondaga people, the Mohawk people, or both. According to some account ...
,
Nginx Nginx (pronounced "engine x" ) is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source softw ...
and almost any other web server through CGI,
FastCGI FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a variation on the earlier Common Gateway Interface (CGI). FastCGI's main aim is to reduce the overhead related to interfacing between web server and CGI ...
,
WSGI The Web Server Gateway Interface (WSGI, pronounced ''whiskey'' or ) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, ...
, mod_proxy, and/or mod_python.


IDEs and debuggers

While a number of web2py developers use text editors such as Vim,
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, ...
or TextMate Web2py also has a built-in web-based IDE. Others prefer more specialized tools providing debugging, refactoring, etc. * Aptana Studio with integrated PyDev *
Eclipse An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three c ...
with PyDev * Eric with built-in debugger. * Wing IDE *
Microsoft Visual Studio Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such ...
with Python Tools for Visual Studio *
Pycharm PyCharm is an integrated development environment (IDE) used for programming in Python. It provides code analysis, a graphical debugger, an integrated unit tester, integration with version control systems, and supports web development with Dja ...
3 has Web2py framework support


Database handling

The database abstraction layer ( DAL) of web2py dynamically and transparently generates SQL queries and runs on multiple compatible database backend without the need for database-specific SQL commands (though SQL commands can be issued explicitly).
SQLite SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the mo ...
is included in Python and is the default web2py database. A connection string change allows connection to Firebird,
IBM Db2 Db2 is a family of data management products, including database servers, developed by IBM. It initially supported the relational model, but was extended to support object–relational features and non-relational structures like JSON a ...
,
Informix IBM Informix is a product family within IBM's Information Management division that is centered on several relational database management system (RDBMS) offerings. The Informix products were originally developed by Informix Corporation, whose ...
,
Ingres Jean-Auguste-Dominique Ingres ( , ; 29 August 1780 – 14 January 1867) was a French Neoclassical painter. Ingres was profoundly influenced by past artistic traditions and aspired to become the guardian of academic orthodoxy against the a ...
,
Microsoft SQL Server Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which ...
,
MySQL MySQL () is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database ...
,
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The word ...
,
PostgreSQL PostgreSQL (, ), also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. It was originally named POSTGRES, referring to its origins as a successor to the ...
, and
Google App Engine Google App Engine (often referred to as GAE or simply App Engine) is a cloud computing platform as a service for developing and hosting web applications in Google-managed data centers. Applications are sandboxed and run across multiple servers ...
(GAE) with some caveats. Specialities: * Multiple database connections. * Automatic table creates and alters. * Automatic transactions. *
Distributed transaction A distributed transaction is a database transaction in which two or more network hosts are involved. Usually, hosts provide transactional resources, while the transaction manager is responsible for creating and managing a global transaction that enc ...
s: ** Since web2py v1.17 with PostgreSQL v8.2 and later, because it provides API for two-phase commits. ** Since web2py v1.70.1 with Firebird and MySQL (experimental). * GAE is not a relational store, but web2py emulates certain operations. The DAL is fast, at least comparable with SQLAlchemy and
Storm A storm is any disturbed state of the natural environment or the atmosphere of an astronomical body. It may be marked by significant disruptions to normal conditions such as strong wind, tornadoes, hail, thunder and lightning (a thunderstorm), ...
. Web2py implements a DAL, not an ORM. An ORM maps database tables into
class Class or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used differently ...
es representing logical abstractions from the database layer (e.g., a User class or a PurchaseOrder class), and maps records into instances of those classes. The DAL instead maps database tables and records into instances of classes representing sets and records instead of higher-level abstractions. It has very similar
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituenc ...
to an ORM but it is faster, and can map almost any SQL expressions into DAL expressions. The DAL can be used independently of the rest of web2py. Here are some examples of DAL syntax: db = DAL('postgresql://user:pass@localhost/db', pool_size=10) db.define_table('person',Field('name'),Field('image','upload')) db.person.insert(name='Martin', image=open('filename.png')) rows = db((db.person.name

'Martin'), db.person.name.contains('T')).select(orderby=db.person.name.lower())
The latest version of the DAL has support for 2D GIS functions with Spatialite and PostGIS. The current API are experimental because of a possible move to 3D APIs.


Automatic database migrations

web2py supports database
migration Migration, migratory, or migrate may refer to: Human migration * Human migration, physical movement by humans from one region to another ** International migration, when peoples cross state boundaries and stay in the host state for some minimum le ...
s—change the definition of a table and web2py ALTERs the table accordingly. Migrations are automatic, but can be disabled for any table, and migration is typically disabled when an application is ready for live distribution. Migrations and migration attempts are logged, documenting the changes. Limitations: * SQLite cannot alter table and change a column type, but rather simply stores new values according to the new type. * GAE has no concept of alter-table, so migrations are limited.


Licenses

Web2py code is released under
GNU Lesser General Public License The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
(LGPL) version 3 as of web2py version 1.91.1. Web2py code before version 1.91.1 was released under GNU GPL v2.0 with commercial exception. Various third-party packages distributed with web2py have their own licenses, generally
public domain The public domain (PD) consists of all the creative work to which no exclusive intellectual property rights apply. Those rights may have expired, been forfeited, expressly waived, or may be inapplicable. Because those rights have expired ...
, MIT or BSD-type licenses. Applications built with web2py are not covered by the LGPL license. Web2py is copyrighted by Massimo DiPierro. The web2py trademark is owned by Massimo DiPierro.


Awards

In 2011
InfoWorld ''InfoWorld'' (abbreviated IW) is an information technology media business. Founded in 1978, it began as a monthly magazine. In 2007, it transitioned to a web-only publication. Its parent company today is International Data Group, and its siste ...
ranked web2py highest among the top six Python web frameworks, awarded web2py the Bossie award 2011 for best open source application development software. In 2012 web2py won the
InfoWorld ''InfoWorld'' (abbreviated IW) is an information technology media business. Founded in 1978, it began as a monthly magazine. In 2007, it transitioned to a web-only publication. Its parent company today is International Data Group, and its siste ...
Technology of the Year award.


Publications


web2py Book

The base web2py documentation is The Official web2py Book, by Massimo DiPierro. The manual is a full web2py application and it's freely available online, in PDF format or printed form. * 1st Edition:
out of print __NOTOC__ An out-of-print (OOP) or out-of-commerce item or work is something that is no longer being published. The term applies to all types of printed matter, visual media, sound recordings, and video recordings. An out-of-print book is a boo ...
. Wiley; September 16, 2008; 256 pages; . * 2nd Edition: web2py Manual. Wiley; August 26, 2009; 341 pages; . * 3rd Edition: Lulu; September 25, 2010 357 pages. * 4th Edition: Lulu; December 9, 2011 583 pages. * 5th Edition: PDF Copy; March 3, 2013 614 pages; . *latest online sources: on GitHub


Online documentation

Online documentation is linked from the web2py home page, with
cookbook A cookbook or cookery book is a kitchen reference containing recipes. Cookbooks may be general, or may specialize in a particular cuisine or category of food. Recipes in cookbooks are organized in various ways: by course (appetizer, first cour ...
, videos, interactive examples, interactive API reference, epydoc s (complete library reference), FAQ,
cheat sheet A cheat sheet (also ''cheatsheet'') or crib sheet is a concise set of notes used for quick reference. Cheat sheets were historically used by students without an instructor or teacher's knowledge to cheat on a test or exam. In the context of hig ...
, online tools etc. * Cheat sheet for web2py. * web2pyslices, recipes posted using the movuca social network in web2py. * Crash Course in Web2py (5-part series). * Web2py slides (old).


Videos

* ''web2py Enterprise Web Framework Tutorial''. * ''web2py "Shootout" video tutorial''. * ''web2py on the Google appengine''. * ''web2py: Create, edit, and deploy a basic web app''.


Printed

* "web2py application development cookbook", Packt, 2012 * ''Web programming with web2py''; ''Python Magazine''; Marco Tabini & Associates, Inc.; June 2008


Background


Developers

The lead developer of web2py is Massimo DiPierro, an associate professor of
Computer Science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
at
DePaul University DePaul University is a private, Catholic research university in Chicago, Illinois. Founded by the Vincentians in 1898, the university takes its name from the 17th-century French priest Saint Vincent de Paul. In 1998, it became the largest Ca ...
in
Chicago (''City in a Garden''); I Will , image_map = , map_caption = Interactive Map of Chicago , coordinates = , coordinates_footnotes = , subdivision_type = List of sovereign states, Count ...
. As of 2011, the web2py homepage lists over 70 "main contributors".List of main contributors to web2py
/ref>


Development source code

The web2py development source code is available from the main repository: *
Git Git () is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data in ...
on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, cont ...
: Web2Py


Third-party software included in web2py

* Python-based
components Circuit Component may refer to: •Are devices that perform functions when they are connected in a circuit.   In engineering, science, and technology Generic systems *System components, an entity with discrete structure, such as an assemb ...
: ** Rocket, a fast, HTTP/1.1-compliant, multi-threaded,
SSL SSL may refer to: Entertainment * RoboCup Small Size League, robotics football competition * ''Sesame Street Live'', a touring version of the children's television show * StarCraft II StarLeague, a Korean league in the video game Natural language ...
-enabled and
streaming Streaming media is multimedia that is delivered and consumed in a continuous manner from a source, with little or no intermediate storage in network elements. ''Streaming'' refers to the delivery method of content, rather than the content i ...
-capable
WSGI The Web Server Gateway Interface (WSGI, pronounced ''whiskey'' or ) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, ...
server; ** fcgi.py: a
FastCGI FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a variation on the earlier Common Gateway Interface (CGI). FastCGI's main aim is to reduce the overhead related to interfacing between web server and CGI ...
/
WSGI The Web Server Gateway Interface (WSGI, pronounced ''whiskey'' or ) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, ...
gateway; ** Login API for Janrain, Dropbox, Google, LDAP, PAM, X509, CAS, OpenID, OAuth 1&2, Loginza ** simplejson: a simple, fast, complete, correct and extensible
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other se ...
encoder and decoder; ** markdown2: a
Markdown Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown i ...
processor; ** fpdf a library for PDF generation; ** PyRTF: an RTF document generator; ** a syntax highlighter; ** pysimplesoap for SOAP services; ** PyRSS2Gen: an RSS generator; ** feedparser: to parse RSS and
Atom Every atom is composed of a nucleus and one or more electrons bound to the nucleus. The nucleus is made of one or more protons and a number of neutrons. Only the most common variety of hydrogen has no neutrons. Every solid, liquid, gas, a ...
feeds. *
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
-based components: ** jQuery: a lightweight JavaScript library; **
CodeMirror CodeMirror is a JavaScript component that provides a code editor in the browser. It has a rich programming API and a focus on extensibility. History The first version of the editor was written early 2007, for the console in the Eloquent JavaS ...
: a free editor for source code; * C-based components: **
SQLite SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the mo ...
: a
relational database A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relati ...
; **
memcached Memcached (pronounced variously ''mem-cash-dee'' or ''mem-cashed'') is a general-purpose distributed memory-caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of ...
: a general-purpose distributed memory caching system. ** Payment API for Authorize.Net, Google Wallet, Stripe.com


History and naming

The source code for the first public version of web2py was released under GNU GPL v2.0 on 2007-09-27 by Massimo DiPierro as the ''Enterprise Web Framework'' (EWF). The name was changed twice due to name conflicts: EWF v1.7 was followed by Gluon v1.0, and Gluon v1.15 was followed by web2py v1.16. The license was changed to LGPLv3 as of web2py version 1.91.1 on 2010-12-21.


Applications built on Web2py

* Movuca
CMS CMS may refer to: Computing * Call management system * CMS-2 (programming language), used by the United States Navy * Code Morphing Software, a technology used by Transmeta * Collection management system for a museum collection * Color manage ...
and Social Network Engine. * Instant Press
Blog A blog (a Clipping (morphology), truncation of "weblog") is a discussion or informational website published on the World Wide Web consisting of discrete, often informal diary-style text entries (posts). Posts are typically displayed in Reverse ...
platform. * Ourway Social networking site. * NoobMusic A rock music website. * LinkFindr Network diagnostic tool. * StarMaker Develops karaoke-style social music apps.


Notes


External links

* {{Authority control Free content management systems Python (programming language) web frameworks