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 and view the source code, design documents, or content of the product. The open source model is a decentrali ...
web application framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
written in the
Python programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
. Web2py allows
web developers to program
dynamic web content 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 from scratch if required.
Web2py was originally designed as a teaching tool with emphasis on ease of use and
deployment. 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 web pa ...
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 divides the related program logic into three interconnected elements. These elements are:
* the model, the internal representat ...
(MVC)
architectural pattern
Software architecture pattern is a reusable, proven solution to a specific, recurring problem focused on architectural design challenges, which can be applied within various architectural styles.
Examples
Some examples of architectural patte ...
.
Overview
Web2py is a
full-stack framework in that it has built-in components for all major functions, including:
*
HTTP
HTTP (Hypertext Transfer Protocol) 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 Web, wher ...
requests, HTTP responses,
cookies
A cookie is a sweet biscuit with high sugar and fat content. Cookie dough is softer than that used for other types of biscuit, and they are cooked longer at lower temperatures. The dough typically contains flour, sugar, egg, and some type of ...
,
sessions;
* multiple protocols
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
/
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
,
REST
REST (Representational State Transfer) is a software architectural style that was created to describe the design and guide the development of the architecture for the World Wide Web. REST defines a set of constraints for how the architecture of ...
,
ATOM
Atoms are the basic particles of the chemical elements. An atom consists of a atomic nucleus, nucleus of protons and generally neutrons, surrounded by an electromagnetically bound swarm of electrons. The chemical elements are distinguished fr ...
and
RSS
RSS ( RDF Site Summary or Really Simple Syndication) is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. Subscribing to RSS feeds can allow a user to keep track of many ...
,
RTF and
CSV,
JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
,
JSON-RPC
JSON-RPC (JavaScript Object Notation-Remote Procedure Call) is a JSON-based wire protocol for remote procedure calls (RPC). It is similar to the XML-RPC protocol, defining only a few data types and commands. JSON-RPC allows for notifications (data ...
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), and
SOAP
Soap is a salt (chemistry), salt of a fatty acid (sometimes other carboxylic acids) used for cleaning and lubricating products as well as other applications. In a domestic setting, soaps, specifically "toilet soaps", are surfactants usually u ...
;
*
CRUD
In computer programming, create, read, update, and delete (CRUD) are the four basic operations (actions) of persistent storage. CRUD is also sometimes used to describe user interface conventions that facilitate viewing, searching, and changing info ...
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
;
* multiple
authentication
Authentication (from ''authentikos'', "real, genuine", from αὐθέντης ''authentes'', "author") is the act of proving an Logical assertion, assertion, such as the Digital identity, identity of a computer system user. In contrast with iden ...
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, and to implementing mandatory access control (MAC) or discretionary access control, discretion ...
;
*
database abstraction layer (DAL) that dynamically generates
SQL
Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel")
is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
and runs on multiple compatible database backends;
*
RAM
Ram, ram, or RAM most commonly refers to:
* A male sheep
* Random-access memory, computer memory
* Ram Trucks, US, since 2009
** List of vehicles named Dodge Ram, trucks and vans
** Ram Pickup, produced by Ram Trucks
Ram, ram, or RAM may also ref ...
,
disk, and
memcached
Memcached (pronounced variously /mɛmkæʃˈdiː/ ''mem-cash-dee'' or /ˈmɛmkæʃt/ ''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 object ...
-based
caching for
scalability
Scalability is the property of a system to handle a growing amount of work. One definition for software systems specifies that this may be done by adding resources to the system.
In an economic context, a scalable business model implies that ...
;
*
internationalization
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 strategy not only for ...
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), ''Ajax'' (play), by the an ...
and
UI effects;
* automatic logging of errors with context.
Web2py encourages sound
software engineering
Software engineering is a branch of both computer science and engineering focused on designing, developing, testing, and maintaining Application software, software applications. It involves applying engineering design process, engineering principl ...
practices such as
* the
model–view–controller
Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divides the related program logic into three interconnected elements. These elements are:
* the model, the internal representat ...
(MVC) pattern;
* self-submission of
web forms;
*
server-side sessions;
* safe handling of uploaded files.
Web2py uses the
WSGI protocol, the Python-oriented protocol for
communication
Communication is commonly defined as the transmission of information. Its precise definition is disputed and there are disagreements about whether Intention, unintentional or failed transmissions are included and whether communication not onl ...
between
web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, co ...
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 pr ...
protocols, and it includes the
multi-threaded
In computer architecture, multithreading is the ability of a central processing unit (CPU) (or a single core in a multi-core processor) to provide multiple threads of execution.
Overview
The multithreading paradigm has become more popular a ...
,
SSL-enabled Rocket wsgiserver.
Distinctive features
Web-based integrated development environment (IDE)
All
development
Development or developing may refer to:
Arts
*Development (music), the process by which thematic material is reshaped
* Photographic development
*Filmmaking, development phase, including finance and budgeting
* Development hell, when a proje ...
,
debugging
In engineering, debugging is the process of finding the Root cause analysis, root cause, workarounds, and possible fixes for bug (engineering), bugs.
For software, debugging tactics can involve interactive debugging, control flow analysis, Logf ...
,
testing,
maintenance
The technical meaning of maintenance involves functional checks, servicing, repairing or replacing of necessary devices, equipment, machinery, building infrastructure and supporting utilities in industrial, business, and residential installa ...
and remote database administration can (optionally) be performed without third-party tools, via a web interface, itself a web2py application.
Internationalization
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 strategy not only for ...
(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 interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
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 which 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 ...
/
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 communication protocols used in the Internet and similar computer networks according to functional criteria. The foundational protocols in the suite are ...
, through encrypted connection.
The
Hello World
Hello World may refer to:
* "Hello, World!" program, a computer program that outputs or displays the message "Hello, World!"
Music
* "Hello World!" (composition), song by the Iamus computer
* "Hello World" (Tremeloes song), 1969
* "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
A template processor (also known as a template engine or template parser) is software designed to combine ''template''s with data (defined by a data model) to produce resulting Electronic document, documents or Computer program, programs.
The ...
, with no
indentation
__FORCETOC__
In the written form of many languages, indentation describes empty space ( white space) used before or around text to signify an important aspect of the text such as:
* Beginning of a paragraph
* Hierarchy subordinate concept
* Qu ...
requirements and a server-side Document Object Model (
DOM).
The template system works without web2py.
Joomla
Joomla (), also styled 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, p ...
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 created Markdown in 2004 as an easy-to-read markup language. Markdown is widely used for blogging and instant messaging, and also used ...
markup to HTML
on the fly
On the fly is a phrase used to describe something that is being changed while the process that the change affects is ongoing. It is used in the automotive, computer, and culinary industries. In cars, on the fly can be used to describe the changin ...
; and markmin which is inspired by markdown but supports tables, html5 video/audio and oembed protocol.
A
controller 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 interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
, 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 (normal ...
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 Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
Windows CE
Windows CE, later known as Windows Embedded CE and Windows Embedded Compact, is a discontinued operating system developed by Microsoft for mobile and embedded devices. It was part of the Windows Embedded family and served as the software foun ...
phones,
Mac,
Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user 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, a ...
/
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
Google App Engine
Google App Engine (also referred to as GAE or App Engine) is a cloud computing platform used as a service for developing and hosting web applications. Applications are sandboxed and run across multiple Google-managed servers. GAE supports aut ...
,
Amazon EC2
Amazon Elastic Compute Cloud (EC2) is a part of Amazon'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 ap ...
, 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 is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
with Jython
Jython is an implementation of the Python (programming language), Python programming language designed to run on the Java (programming language), Java platform. It was known as JPython until 1999.
Overview
Jython programs can import and use any ...
2.5, without any known limitation.
web2py code can run with IronPython
IronPython is an implementation of the Python programming language targeting the .NET and Mono frameworks. The project is currently maintained by a group of volunteers at GitHub. It is free and open-source software, and can be implemented with P ...
on .NET
The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
. Limitations:
* no ''csv'' module (so no database I/O);
* no third party database drivers (not even SQLite
SQLite ( "S-Q-L-ite", "sequel-ite") is a free and open-source relational 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 ...
, 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 or a portable hard drive without dependencies, like Portable Python.
Web servers
Web2py can service requests via HTTP
HTTP (Hypertext Transfer Protocol) 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 Web, wher ...
and HTTPS
Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP). It uses encryption for secure communication over a computer network, and is widely used on the Internet. In HTTPS, the communication protoc ...
with its built-in Rocket server, with Apache
The Apache ( ) are several Southern Athabaskan language-speaking peoples of the Southwestern United States, Southwest, the Southern Plains and Northern Mexico. They are linguistically related to the Navajo. They migrated from the Athabascan ho ...
, Lighttpd
lighttpd (prescribed pronunciation: "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 ...
, Cherokee
The Cherokee (; , or ) people are one of the Indigenous peoples of the Southeastern Woodlands of the United States. Prior to the 18th century, they were concentrated in their homelands, in towns along river valleys of what is now southwestern ...
, Hiawatha
Hiawatha ( , also : ), also known as Ayenwatha or Aiionwatha, was a precolonial Native American leader and cofounder of the Iroquois Confederacy. He was a leader of the Onondaga people, the Mohawk people, or both. According to some accounts, he ...
, Nginx
(pronounced "engine x" , stylized as NGINX or nginx) 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 Russian developer Igor Sysoev and publicly released in 20 ...
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 pr ...
, WSGI, mod_proxy
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, US
* ...
, and/or mod_python.
IDEs and debuggers
While a number of web2py developers use text editors
A text editor is a type of computer program that edits plain text. An example of such program is "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be used to ...
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, s ...
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 which 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 ...
with PyDev
*Eric
The given name Eric, Erich, Erikk, Erik, Erick, Eirik, or Eiríkur is derived from the Old Norse name ''Eiríkr'' (or ''Eríkr'' in Old East Norse due to monophthongization).
The first element, ''ei-'' may be derived from the older Proto-N ...
with built-in debugger.
* Wing IDE
*Microsoft Visual Studio
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms ...
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 D ...
3 has Web2py framework support
Database handling
The database abstraction layer (DAL
Dal is a term in the Indian subcontinent for dried, split pulses.
Dal or DAL may also refer to:
Places
Cambodia
*Dal, Ke Chong
Finland
* Laakso, a neighbourhood of Helsinki
India
* Dal Lake, in Srinagar, Jammu and Kashmir, India
* 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 ( "S-Q-L-ite", "sequel-ite") is a free and open-source relational 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 ...
is included in Python and is the default web2py database. A connection string change allows connection to Firebird, IBM Db2, Informix
Informix is a product family within IBM's Information Management division that is centered on several relational database management system (RDBMS) and multi-model database offerings. The Informix products were originally developed by Inform ...
, Ingres, Microsoft SQL Server
Microsoft SQL Server is a proprietary relational database management system developed by Microsoft using Structured Query Language (SQL, often pronounced "sequel"). As a database server, it is a software product with the primary function of ...
, MySQL
MySQL () is an Open-source software, 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 rel ...
, Oracle
An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination.
Descript ...
, PostgreSQL
PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
, and Google App Engine
Google App Engine (also referred to as GAE or App Engine) is a cloud computing platform used as a service for developing and hosting web applications. Applications are sandboxed and run across multiple Google-managed servers. GAE supports aut ...
(GAE) with some caveats. Specialities:
* Multiple database connections.
* Automatic table creates and alters.
* Automatic transactions.
* Distributed transaction
A distributed transaction operates within a distributed environment, typically involving multiple nodes across a network depending on the location of the data. A key aspect of distributed transactions is atomicity, which ensures that the transact ...
s:
** Since web2py v1.17 with PostgreSQL v8.2 and later, because it provides API for two-phase commit Two-phase may refer to:
* Two-phase electric power
* Two-phase commit protocol
* Two-phase flow
* Two-phase locking
* Binary phase, chemical compounds composed of two elements
{{Disambig ...
s.
** 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
SQLAlchemy is an open-source Python library that provides an SQL toolkit (called "SQLAlchemy Core") and an object–relational mapper (ORM) for database interactions. It allows developers to work with databases using Python objects, enabling e ...
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 thunderstor ...
.
Web2py implements a DAL, not an ORM. An ORM map
A map is a symbolic depiction of interrelationships, commonly spatial, between things within a space. A map may be annotated with text and graphics. Like any graphic, a map may be fixed to paper or other durable media, or may be displayed on ...
s database tables into class
Class, Classes, 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 d ...
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 exclusive intellectual property rights apply. Those rights may have expired, been forfeited, expressly Waiver, waived, or may be inapplicable. Because no one holds ...
, MIT
The Massachusetts Institute of Technology (MIT) is a private research university in Cambridge, Massachusetts, United States. Established in 1861, MIT has played a significant role in the development of many areas of modern technology and sc ...
or BSD
The Berkeley Software Distribution (BSD), also known as Berkeley Unix or BSD Unix, is a discontinued Unix operating system developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berkeley, beginni ...
-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'' (''IW'') is an American 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 is International Data Group, and its sister pu ...
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'' (''IW'') is an American 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 is International Data Group, and its sister pu ...
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
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 book that is ...
. 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 (food), course (appetize ...
, videos, interactive examples, interactive API reference, epydoc s (complete library reference), FAQ, cheat sheet
A cheat sheet (also ''cheatsheet'') or crib sheet or job aid 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 ...
, 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, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
at DePaul University
DePaul University is a private university, private Catholic higher education, Catholic research university in Chicago, Illinois, United States. Founded by the Congregation of the Mission, Vincentians in 1898, the university takes its name from ...
in Chicago
Chicago is the List of municipalities in Illinois, most populous city in the U.S. state of Illinois and in the Midwestern United States. With a population of 2,746,388, as of the 2020 United States census, 2020 census, it is the List of Unite ...
. 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 that tracks versions of files. It is often used to control source code by programmers who are developing software collaboratively.
Design goals of Git include speed, data integrity, and suppor ...
on GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
: Web2Py
Third-party software included in web2py
* Python-based components
Component may refer to:
In engineering, science, and technology Generic systems
*System components, an entity with discrete structure, such as an assembly or software module, within a system considered at a particular level of analysis
* Lumped e ...
:
** Rocket, a fast, HTTP/1.1-compliant, multi-threaded
In computer architecture, multithreading is the ability of a central processing unit (CPU) (or a single core in a multi-core processor) to provide multiple threads of execution.
Overview
The multithreading paradigm has become more popular a ...
, SSL-enabled and streaming
Streaming media refers to multimedia delivered through a network for playback using a media player. Media is transferred in a ''stream'' of packets from a server to a client and is rendered in real-time; this contrasts with file downl ...
-capable 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 pr ...
/ 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 or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
encoder and decoder;
** markdown2: a Markdown
Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber created Markdown in 2004 as an easy-to-read markup language. Markdown is widely used for blogging and instant messaging, and also used ...
processor;
** fpdf a library for PDF generation;
** PyRTF: an RTF document generator;
** a syntax highlighter;
** pysimplesoap for SOAP services;
** PyRSS2Gen: an RSS
RSS ( RDF Site Summary or Really Simple Syndication) is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. Subscribing to RSS feeds can allow a user to keep track of many ...
generator;
** feedparser: to parse RSS and Atom
Atoms are the basic particles of the chemical elements. An atom consists of a atomic nucleus, nucleus of protons and generally neutrons, surrounded by an electromagnetically bound swarm of electrons. The chemical elements are distinguished fr ...
feeds.
* JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
-based components:
** jQuery: a lightweight JavaScript library
A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies. They can be included in a website by embedding it directl ...
;
** CodeMirror: a free editor for source code;
* C-based components:
** SQLite
SQLite ( "S-Q-L-ite", "sequel-ite") is a free and open-source relational 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 ...
: a relational database
A relational database (RDB) is a database based on the relational model of data, as proposed by E. F. Codd in 1970.
A Relational Database Management System (RDBMS) is a type of database management system that stores data in a structured for ...
;
** memcached
Memcached (pronounced variously /mɛmkæʃˈdiː/ ''mem-cash-dee'' or /ˈmɛmkæʃt/ ''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 object ...
: 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 and Social Network Engine.
* Instant Press Blog
A blog (a Clipping (morphology), truncation of "weblog") is an informational website consisting of discrete, often informal diary-style text entries also known as posts. Posts are typically displayed in Reverse chronology, reverse chronologic ...
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