#TIL Web2Py Is Kind of Neat

In looking at some source code from a job applicant, I had to install and run the Web2Py framework – a web framework written for Python. While I had known it existed, I never used it before. After downloading it to my PC, extracting the files, and running web2py.exe, I found some neat stuff!

I initially thought Web2Py was simply a web server or module that ran python code in response to web requests, and provided some python libraries to return an appropriate response. Boy was I wrong! In addition to being a web server, it also ships as a web framework, providing a Model-View-Controller structure for python classes, an entire web administration interface, and integrates with a number of other web servers including Apache, Lighttpd, Cherokee, and Google App Engine.

It also takes a few tricks from Rails and other frameworks, providing utilities to generate scaffolds based on your database schema for web forms and validations. They also provide a data abstraction layer to avoid having web developers write SQL directly, and supports 10 different database engines.

One thing I found kind of weird is how strongly they adhere to the MVC pattern. While it is “the standard” for server-side apps, it’s a bit weird to have a web module adhere to one approach so strongly. Perhaps it’s just because of my perspective of Web2Py being a web module rather than a web framework.

Another cool thing is a built-in ticketing system – if a web application ever generates a 500 error, a ticket is automatically created with all the server-side information involved to debug the issue. This ticket can be managed via the built-in web administration interface.

The administration interface is pretty powerful, allowing you to create or install new web applications either locally, remotely, or from git repos. It also allows you to edit source code, manage temporary files, browsing error history with debug data, run unit tests, and interact with an application’s database. Most of this functionality is also available through the command line.

Web2Py is an open source project, maintained by a community of python developers. You can find out more about it and give it a try at web2py.com.

Comments