Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

web development

Running web2py with Python 2 vs. Python 3

Educative Answers Team


Web2py is a free, open-source web framework for agile development of secure database-driven web applications. It is written in Python and programmable in python2 and python3. Web2py is a full-stack framework, which means it contains all the components you need to build fully functional web applications.

Why use web2py?

svg viewer

A Database Abstraction Layer (DAL) is an application programming interface that unifies the communication between a computer application and databases.

MVC separates an application into three components - Model, View, and Controller:

  • Model: Model represents the shape of the data.
  • View is the user interface.
  • Controller handles all the requests.

Running web2py with Python2 vs. Python3


When web2py was released, it was only compatible with python2 version 2.5. Ten years after the release of python3 version 3.0 in 2008, web2py was compatible with version 3.5+. Many recent releases are not compatible with older versions of python.

Python3 compatibility was indeed a huge milestone (for many, many reasons), but it required a careful check and rewrite of most of the framework. The compatibility of all required external libraries was a missing requirement for a long time.

For newer projects, it is advisable to use the latest releases of web2py in the source form and run it with Python version 3.

It is necessary that web2py apps created with Python2 require web2py running under Python2, and apps created using Python3 require web2py running Python3.


Here is a summary of the web2py workflow:

  1. An HTTP requests is received by the web server.

  2. The request header is parsed and passed further towards a dispatcher that chooses one of the installed applications to handle the request.

  3. An execution environment for the particular request is created to execute these models. The controller action is executed in this environment.

  4. The entire user code is executed in a single database transaction.


web development
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring